Get list of Pod field option tabs

@param array $pod Pod options.

@return array
199952
public function admin_setup_edit_field_tabs( $pod ) {

		$core_tabs = array(
			'basic'            => __( 'Basic', 'pods' ),
			'additional-field' => __( 'Additional Field Options', 'pods' ),
			'advanced'         => __( 'Advanced', 'pods' ),
		);

		/**
		 * Field option tabs
		 *
		 * Use to add new tabs, default tabs are added after this filter (IE you can't remove/modify them with this, kthanksbye).
		 *
		 * @since unknown
		 *
		 * @param array      $tabs Tabs to add, starts empty.
		 * @param object|Pod $pod  Current Pods object.
		 */
		$tabs = apply_filters( 'pods_admin_setup_edit_field_tabs', array(), $pod );

		$tabs = array_merge( $core_tabs, $tabs );

		return $tabs;
	}
781953
public function admin_components() {

		if ( ! is_object( PodsInit::$components ) ) {
			return;
		}

		$components = PodsInit::$components->components;

		$view = pods_v( 'view', 'get', 'all', true );

		$recommended = array(
			'advanced-relationships',
			'advanced-content-types',
			'migrate-packages',
			'roles-and-capabilities',
			'pages',
			'table-storage',
			'templates',
		);

		foreach ( $components as $component => &$component_data ) {
			if ( ! in_array(
				$view, array(
					'all',
					'recommended',
					'dev',
				), true
			) && ( ! isset( $component_data['Category'] ) || sanitize_title( $component_data['Category'] ) !== $view ) ) {
				unset( $components[ $component ] );

				continue;
			} elseif ( 'recommended' === $view && ! in_array( $component_data['ID'], $recommended, true ) ) {
				unset( $components[ $component ] );

				continue;
			} elseif ( 'dev' === $view && pods_developer() && ! pods_v( 'DeveloperMode', $component_data, false ) ) {
				unset( $components[ $component ] );

				continue;
			} elseif ( pods_v( 'DeveloperMode', $component_data, false ) && ! pods_developer() ) {
				unset( $components[ $component ] );

				continue;
			} elseif ( ! pods_v( 'TablelessMode', $component_data, false ) && pods_tableless() ) {
				unset( $components[ $component ] );

				continue;
			}//end if

			$component_data['Name'] = strip_tags( $component_data['Name'] );

			if ( pods_v( 'DeveloperMode', $component_data, false ) ) {
				$component_data['Name'] .= ' <em style="font-weight: normal; color:#333;">(Developer Preview)</em>';
			}

			$meta = array();

			if ( ! empty( $component_data['Version'] ) ) {
				$meta[] = sprintf( __( 'Version %s', 'pods' ), $component_data['Version'] );
			}

			if ( empty( $component_data['Author'] ) ) {
				$component_data['Author']    = 'Pods Framework Team';
				$component_data['AuthorURI'] = 'https://pods.io/';
			}

			if ( ! empty( $component_data['AuthorURI'] ) ) {
				$component_data['Author'] = '<a href="' . $component_data['AuthorURI'] . '">' . $component_data['Author'] . '</a>';
			}

			$meta[] = sprintf( __( 'by %s', 'pods' ), $component_data['Author'] );

			if ( ! empty( $component_data['URI'] ) ) {
				$meta[] = '<a href="' . $component_data['URI'] . '">' . __( 'Visit component site', 'pods' ) . '</a>';
			}

			$component_data['Description'] = wpautop( trim( make_clickable( strip_tags( $component_data['Description'], 'em,strong' ) ) ) );

			if ( ! empty( $meta ) ) {
				$description_style = '';

				if ( ! empty( $component_data['Description'] ) ) {
					$description_style = ' style="padding:8px 0 4px;"';
				}

				$component_data['Description'] .= '<div class="pods-component-meta" ' . $description_style . '>' . implode( '&nbsp;&nbsp;|&nbsp;&nbsp;', $meta ) . '</div>';
			}

			$component_data = array(
				'id'          => $component_data['ID'],
				'name'        => $component_data['Name'],
				'category'    => $component_data['Category'],
				'version'     => '',
				'description' => $component_data['Description'],
				'mustuse'     => pods_v( 'MustUse', $component_data, false ),
				'toggle'      => 0,
			);

			if ( ! empty( $component_data['category'] ) ) {
				$category_url = pods_query_arg(
					array(
						'view' => sanitize_title( $component_data['category'] ),
						'pg'   => '',
						// @codingStandardsIgnoreLine
						'page' => $_GET['page'],
					)
				);

				$component_data['category'] = '<a href="' . esc_url( $category_url ) . '">' . $component_data['category'] . '</a>';
			}

			if ( isset( PodsInit::$components->settings['components'][ $component_data['id'] ] ) && 0 !== PodsInit::$components->settings['components'][ $component_data['id'] ] ) {
				$component_data['toggle'] = 1;
			} elseif ( $component_data['mustuse'] ) {
				$component_data['toggle'] = 1;
			}
		}//end foreach

		$ui = array(
			'data'             => $components,
			'total'            => count( $components ),
			'total_found'      => count( $components ),
			'items'            => __( 'Components', 'pods' ),
			'item'             => __( 'Component', 'pods' ),
			'fields'           => array(
				'manage' => array(
					'name'        => array(
						'label'   => __( 'Name', 'pods' ),
						'width'   => '30%',
						'type'    => 'text',
						'options' => array(
							'text_allow_html' => true,
						),
					),
					'category'    => array(
						'label'   => __( 'Category', 'pods' ),
						'width'   => '10%',
						'type'    => 'text',
						'options' => array(
							'text_allow_html' => true,
						),
					),
					'description' => array(
						'label'   => __( 'Description', 'pods' ),
						'width'   => '60%',
						'type'    => 'text',
						'options' => array(
							'text_allow_html'        => true,
							'text_allowed_html_tags' => 'strong em a ul ol li b i br div',
						),
					),
				),
			),
			'actions_disabled' => array( 'duplicate', 'view', 'export', 'add', 'edit', 'delete' ),
			'actions_custom'   => array(
				'toggle' => array(
					'callback' => array( $this, 'admin_components_toggle' ),
					'nonce'    => true,
				),
			),
			'filters_enhanced' => true,
			'views'            => array(
				'all'         => __( 'All', 'pods' ),
				// 'recommended' => __( 'Recommended', 'pods' ),
				'field-types' => __( 'Field Types', 'pods' ),
				'tools'       => __( 'Tools', 'pods' ),
				'integration' => __( 'Integration', 'pods' ),
				'migration'   => __( 'Migration', 'pods' ),
				'advanced'    => __( 'Advanced', 'pods' ),
			),
			'view'             => $view,
			'heading'          => array(
				'views' => __( 'Category', 'pods' ),
			),
			'search'           => false,
			'searchable'       => false,
			'sortable'         => false,
			'pagination'       => false,
		);

		if ( pods_developer() ) {
			$ui['views']['dev'] = __( 'Developer Preview', 'pods' );
		}

		pods_ui( $ui );
	}
721064
public static function options_setup( $type = null, $options = null ) {

		$core_defaults = array(
			'id'             => 0,
			'name'           => '',
			'label'          => '',
			'description'    => '',
			'help'           => '',
			'default'        => null,
			'attributes'     => array(),
			'class'          => '',
			'type'           => 'text',
			'group'          => 0,
			'grouped'        => 0,
			'developer_mode' => false,
			'dependency'     => false,
			'depends-on'     => array(),
			'excludes-on'    => array(),
			'options'        => array(),
		);

		if ( ! empty( $options ) && is_array( $options ) ) {
			$core_defaults = array_merge( $core_defaults, $options );
		}

		if ( null === $type ) {
			return $core_defaults;
		} else {
			self::field_loader( $type );
		}

		$options = apply_filters( "pods_field_{$type}_options", (array) self::$loaded[ $type ]->options(), $type );

		$first_field = current( $options );

		if ( ! empty( $options ) && ! isset( $first_field['name'] ) && ! isset( $first_field['label'] ) ) {
			$all_options = array();

			foreach ( $options as $group => $group_options ) {
				$all_options = array_merge( $all_options, self::fields_setup( $group_options, $core_defaults ) );
			}

			$options = $all_options;
		} else {
			$options = self::fields_setup( $options, $core_defaults );
		}

		return $options;
	}
479792
public function register( $type, $pod ) {

		$pod_type = $type;

		if ( 'post_type' == $type ) {
			$type = 'post_types';
		} elseif ( 'taxonomy' == $type ) {
			$type = 'taxonomies';
		} elseif ( 'pod' == $type ) {
			$type = 'advanced_content_types';
		}

		if ( ! isset( self::$queue[ $type ] ) ) {
			self::$queue[ $type ] = array();
		}

		if ( is_array( $pod ) && ! empty( $pod ) && ! isset( $pod['name'] ) ) {
			$data = array();

			foreach ( $pod as $p ) {
				$data[] = $this->register( $type, $p );
			}

			return $data;
		}

		$pod['type'] = $pod_type;
		$pod         = pods_api()->save_pod( $pod, false, false );

		if ( ! empty( $pod ) ) {
			self::$object_identifier --;

			self::$queue[ $type ][ $pod['name'] ] = $pod;

			return $pod;
		}

		return false;
	}
1058405
public function menu( $parent ) {

		global $submenu;

		$custom_component_menus = array();

		$pods_component_menu_items = array();

		foreach ( $this->components as $component => $component_data ) {
			$component_id = $component_data['ID'];

			$component_data['MustUse'] = apply_filters( "pods_component_require_{$component_id}", $component_data['MustUse'], $component_data );

			if ( empty( $component_data['MustUse'] ) && ( ! isset( $this->settings['components'][ $component ] ) || 0 === $this->settings['components'][ $component ] ) ) {
				continue;
			}

			if ( ! empty( $component_data['Hide'] ) ) {
				continue;
			}

			if ( ! empty( $component_data['DeveloperMode'] ) && ! pods_developer() ) {
				continue;
			}

			if ( empty( $component_data['TablelessMode'] ) && pods_tableless() ) {
				continue;
			}

			if ( empty( $component_data['MenuPage'] ) ) {
				if ( ! isset( $component_data['object'] ) ) {
					continue;
				} elseif ( ! method_exists( $component_data['object'], 'admin' ) && ! method_exists( $component_data['object'], 'options' ) ) {
					continue;
				}
			}

			if ( false === $component_data['External'] ) {
				$component_data['File'] = realpath( $this->components_dir . $component_data['File'] );
			}

			if ( ! file_exists( $component_data['File'] ) ) {
				pods_message( 'Pods Component not found: ' . $component_data['File'] );

				pods_transient_clear( 'pods_components' );

				continue;
			}

			$capability = 'pods_component_' . str_replace( '-', '_', sanitize_title( $component ) );

			if ( 0 < strlen( $component_data['Capability'] ) ) {
				$capability = $component_data['Capability'];
			}

			if ( ! pods_is_admin( array( 'pods', 'pods_components', $capability ) ) ) {
				continue;
			}

			$menu_page = 'pods-component-' . $component;

			if ( ! empty( $component_data['MenuPage'] ) ) {
				$custom_component_menus[ $menu_page ] = $component_data;
			}

			$pods_component_menu_items[ $component_data['MenuName'] ] = array(
				'menu_page'  => $menu_page,
				'page_title' => $component_data['Name'],
				'capability' => 'read',
				'callback'   => array( $this, 'admin_handler' ),
			);

			if ( isset( $component_data['object'] ) && method_exists( $component_data['object'], 'admin_assets' ) ) {
				$pods_component_menu_items[ $component_data['MenuName'] ]['assets'] = array(
					$component_data['object'],
					'admin_assets',
				);
			}
		}//end foreach

		/**
		 * Add or change the items in the Pods Components Submenu.
		 *
		 * Can also be used to change which menu components is a submenu of or change title of menu.
		 *
		 * @param array $pods_component_menu_items {
		 *      An array of arguments for add_submenu_page
		 *
		 *     @type string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page)
		 *     @type string $page_title  The text to be displayed in the title tags of the page when the menu is selected
		 *     @type string $menu_title  The text to be used for the menu
		 *     @type string $capability  The capability required for this menu to be displayed to the user.
		 *     @type string $menu_slug   The slug name to refer to this menu by (should be unique for this menu)
		 *     @type string $function    The function to be called to output the content for this page.
		 * }
		 *
		 * @since  2.4.1
		 */
		$pods_component_menu_items = apply_filters( 'pods_admin_components_menu', $pods_component_menu_items );

		ksort( $pods_component_menu_items );

		foreach ( $pods_component_menu_items as $menu_title => $menu_data ) {
			if ( ! is_callable( $menu_data['callback'] ) ) {
				continue;
			}

			$page = add_submenu_page( $parent, strip_tags( $menu_data['page_title'] ), '- ' . strip_tags( $menu_title ), pods_v( 'capability', $menu_data, 'read', true ), $menu_data['menu_page'], $menu_data['callback'] );

			if ( isset( $menu_data['assets'] ) && is_callable( $menu_data['assets'] ) ) {
				add_action( 'admin_print_styles-' . $page, $menu_data['assets'] );
			}
		}

		if ( ! empty( $custom_component_menus ) ) {
			foreach ( $custom_component_menus as $menu_page => $component_data ) {
				if ( isset( $submenu[ $parent ] ) ) {
					foreach ( $submenu[ $parent ] as $sub => &$menu ) {
						if ( $menu[2] === $menu_page ) {
							$menu_page = $component_data['MenuPage'];

							$menu[2] = $menu_page;

							$page = current( explode( '?', $menu[2] ) );

							if ( isset( $component_data['object'] ) && method_exists( $component_data['object'], 'admin_assets' ) ) {
								add_action(
									'admin_print_styles-' . $page, array(
										$component_data['object'],
										'admin_assets',
									)
								);
							}

							break;
						}//end if
					}//end foreach
				}//end if
			}//end foreach
		}//end if
	}
423365
public function getOptions($keywords = null)
    {
        if (!isset($this->attributeKey)) {
            return [];
        }

        if (!is_object($this->attributeKey->getAttributeKeySettings())) {
            return [];
        }

        if (!isset($this->akSelectOptionDisplayOrder)) {
            $this->load();
        }

        $type = $this->attributeKey->getAttributeKeySettings();

        $em = \Database::get()->getEntityManager();
        $r = $em->getRepository('\Concrete\Core\Entity\Attribute\Value\Value\SelectValueOption');
        $builder = $r->createQueryBuilder('v');
        $builder->where('v.list = :list');
        $builder->andWhere('v.isDeleted = false');
        if ($keywords) {
            $builder->andWhere($builder->expr()->like('v.value', ':value'));
            $builder->setParameter('value', $keywords . '%');
        }
        $builder->setParameter('list', $type->getOptionList());
        $options = [];
        switch ($this->akSelectOptionDisplayOrder) {
            case 'popularity_desc':
                $builder->addSelect('count(va.generic_value) as total');
                $builder->leftJoin('v.values', 'va');
                $builder->groupBy('v.avSelectOptionID');
                $builder->orderBy('total', 'desc');
                $r = $builder->getQuery()->getResult();
                foreach ($r as $option) {
                    $options[] = $option[0];
                }
                break;
            case 'alpha_asc':
                $builder->orderBy('v.value', 'asc');
                $options = $builder->getQuery()->getResult();
                break;
            default:
                $builder->orderBy('v.displayOrder', 'asc');
                $options = $builder->getQuery()->getResult();
                break;
        }

        return $options;
    }
161097
public function get_components() {

		$components = pods_transient_get( 'pods_components' );

		if ( 1 === (int) pods_v( 'pods_debug_components', 'get', 0 ) && pods_is_admin( array( 'pods' ) ) ) {
			$components = array();
		}

		if ( PODS_VERSION !== PodsInit::$version || ! is_array( $components ) || empty( $components ) || ( is_admin() && 'pods-components' === pods_v( 'page' ) && 1 !== (int) pods_transient_get( 'pods_components_refresh' ) ) ) {
			do_action( 'pods_components_get' );

			// @codingStandardsIgnoreLine
			$component_dir   = @opendir( untrailingslashit( $this->components_dir ) );
			$component_files = array();

			if ( false !== $component_dir ) {
				$file = readdir( $component_dir );

				while ( false !== $file ) {
					if ( '.' === substr( $file, 0, 1 ) ) {
						// Get next file
						$file = readdir( $component_dir );

						continue;
					} elseif ( is_dir( $this->components_dir . $file ) ) {
						// @codingStandardsIgnoreLine
						$component_subdir = @opendir( $this->components_dir . $file );

						if ( $component_subdir ) {
							$subfile = readdir( $component_subdir );

							while ( false !== $subfile ) {
								if ( '.' === substr( $subfile, 0, 1 ) ) {
									// Get next file
									$subfile = readdir( $component_subdir );

									continue;
								} elseif ( '.php' === substr( $subfile, - 4 ) ) {
									$component_files[] = str_replace( '\\', '/', $file . '/' . $subfile );
								}

								// Get next file
								$subfile = readdir( $component_subdir );
							}

							closedir( $component_subdir );
						}
					} elseif ( '.php' === substr( $file, - 4 ) ) {
						$component_files[] = $file;
					}//end if

					// Get next file
					$file = readdir( $component_dir );
				}//end while

				closedir( $component_dir );
			}//end if

			$default_headers = array(
				'ID'               => 'ID',
				'Name'             => 'Name',
				'ShortName'        => 'Short Name',
				'PluginName'       => 'Plugin Name',
				'ComponentName'    => 'Component Name',
				'URI'              => 'URI',
				'MenuName'         => 'Menu Name',
				'MenuPage'         => 'Menu Page',
				'MenuAddPage'      => 'Menu Add Page',
				'MustUse'          => 'Must Use',
				'Description'      => 'Description',
				'Version'          => 'Version',
				'Category'         => 'Category',
				'Author'           => 'Author',
				'AuthorURI'        => 'Author URI',
				'Class'            => 'Class',
				'Hide'             => 'Hide',
				'PluginDependency' => 'Plugin Dependency',
				'ThemeDependency'  => 'Theme Dependency',
				'DeveloperMode'    => 'Developer Mode',
				'TablelessMode'    => 'Tableless Mode',
				'Capability'       => 'Capability',
				'Plugin'           => 'Plugin',
			);

			$component_files = apply_filters( 'pods_components_register', $component_files );

			$components = array();

			foreach ( $component_files as $component_file ) {
				$external = false;

				if ( is_array( $component_file ) && isset( $component_file['File'] ) ) {
					$component_file = $component_file['File'];
					$component      = $component_file;

					$external = true;
				} else {
					$component = $this->components_dir . $component_file;
				}

				if ( ! is_readable( $component ) ) {
					continue;
				}

				$component_data = get_file_data( $component, $default_headers, 'pods_component' );

				if ( ( empty( $component_data['Name'] ) && empty( $component_data['ComponentName'] ) && empty( $component_data['PluginName'] ) ) || 'yes' === $component_data['Hide'] ) {
					continue;
				}

				if ( isset( $component_data['Plugin'] ) && pods_is_plugin_active( $component_data['Plugin'] ) ) {
					continue;
				}

				if ( empty( $component_data['Name'] ) ) {
					if ( ! empty( $component_data['ComponentName'] ) ) {
						$component_data['Name'] = $component_data['ComponentName'];
					} elseif ( ! empty( $component_data['PluginName'] ) ) {
						$component_data['Name'] = $component_data['PluginName'];
					}
				}

				if ( empty( $component_data['ShortName'] ) ) {
					$component_data['ShortName'] = $component_data['Name'];
				}

				if ( empty( $component_data['MenuName'] ) ) {
					$component_data['MenuName'] = $component_data['Name'];
				}

				if ( empty( $component_data['Class'] ) ) {
					$component_data['Class'] = 'Pods_' . pods_js_name( basename( $component, '.php' ), false );
				}

				if ( empty( $component_data['ID'] ) ) {
					$component_data['ID'] = $component_data['Name'];
				}

				$component_data['ID'] = sanitize_title( $component_data['ID'] );

				if ( 'on' === strtolower( $component_data['DeveloperMode'] ) && '1' === $component_data['DeveloperMode'] ) {
					$component_data['DeveloperMode'] = true;
				} else {
					$component_data['DeveloperMode'] = false;
				}

				if ( 'on' === strtolower( $component_data['TablelessMode'] ) && '1' === $component_data['TablelessMode'] ) {
					$component_data['TablelessMode'] = true;
				} else {
					$component_data['TablelessMode'] = false;
				}

				$component_data['External'] = $external;

				if ( 'on' === strtolower( $component_data['MustUse'] ) || '1' === $component_data['MustUse'] ) {
					$component_data['MustUse'] = true;
				} elseif ( 'off' === strtolower( $component_data['MustUse'] ) || '0' === $component_data['MustUse'] ) {
					$component_data['MustUse'] = false;
				} else {
					$component_data['MustUse'] = $component_data['External'];
				}

				$component_data['File'] = $component_file;

				$components[ $component_data['ID'] ] = $component_data;
			}//end foreach

			ksort( $components );

			pods_transient_set( 'pods_components_refresh', 1, ( 60 * 60 * 12 ) );

			pods_transient_set( 'pods_components', $components );
		}//end if

		if ( 1 === (int) pods_v( 'pods_debug_components', 'get', 0 ) && pods_is_admin( array( 'pods' ) ) ) {
			pods_debug( $components );
		}

		$this->components = $components;

		return $this->components;
	}
1306976
public function prepare_pod( $params ) {

		/**
		 * @var $wpdb WPDB
		 */
		global $wpdb;

		if ( ! isset( $params->pod ) ) {
			return pods_error( __( 'Invalid Pod.', 'pods' ) );
		}

		$pod = pods_sanitize( pods_clean_name( $params->pod ) );

		if ( ! in_array( "{$wpdb->prefix}pod_tbl_{$pod}", $this->tables, true ) ) {
			return pods_error( __( 'Table not found, it cannot be migrated', 'pods' ) );
		}

		$count = pods_query( "SELECT COUNT(*) AS `count` FROM `@wp_pod_tbl_{$pod}`", false );

		if ( ! empty( $count ) ) {
			$count = (int) $count[0]->count;
		} else {
			$count = 0;
		}

		$pod_type = pods_query( "SELECT `id` FROM `@wp_pod_types` WHERE `name` = '{$pod}'", false );

		if ( ! empty( $pod_type ) ) {
			$pod_type = (int) $pod_type[0]->id;
		} else {
			return pods_error( __( 'Pod not found, it cannot be migrated', 'pods' ) );
		}

		$fields = array( 'id' );

		$field_rows = pods_query( "SELECT `id`, `name`, `coltype` FROM `@wp_pod_fields` WHERE `datatype` = {$pod_type} ORDER BY `weight`, `name`" );

		if ( ! empty( $field_rows ) ) {
			foreach ( $field_rows as $field ) {
				if ( ! in_array( $field->coltype, array( 'pick', 'file' ), true ) ) {
					$fields[] = $field->name;
				}
			}
		}

		$columns = PodsData::get_table_columns( "{$wpdb->prefix}pod_tbl_{$pod}" );

		$errors = array();

		foreach ( $columns as $column => $info ) {
			if ( ! in_array( $column, $fields, true ) ) {
				$errors[] = "<strong>{$column}</strong> " . __( 'is a field in the table, but was not found in this pod - the field data will not be migrated.', 'pods' );
			}
		}

		foreach ( $fields as $field ) {
			if ( ! isset( $columns[ $field ] ) ) {
				$errors[] = "<strong>{$field}</strong> " . __( 'is a field in this pod, but was not found in the table - the field data will not be migrated.', 'pods' );
			}
		}

		if ( ! empty( $errors ) ) {
			return pods_error( implode( '<br />', $errors ) );
		}

		return $count;
	}
207846
public function admin_capabilities( $capabilities ) {

		$pods = pods_api()->load_pods(
			array(
				'type'       => array(
					'settings',
					'post_type',
					'taxonomy',
				),
				'fields'     => false,
				'table_info' => false,
			)
		);

		$other_pods = pods_api()->load_pods(
			array(
				'type'       => array(
					'pod',
					'table',
				),
				'table_info' => false,
			)
		);

		$pods = array_merge( $pods, $other_pods );

		$capabilities[] = 'pods';
		$capabilities[] = 'pods_content';
		$capabilities[] = 'pods_settings';
		$capabilities[] = 'pods_components';

		foreach ( $pods as $pod ) {
			if ( 'settings' === $pod['type'] ) {
				$capabilities[] = 'pods_edit_' . $pod['name'];
			} elseif ( 'post_type' === $pod['type'] ) {
				$capability_type = pods_v_sanitized( 'capability_type_custom', $pod['options'], pods_v( 'name', $pod ) );

				if ( 'custom' === pods_v( 'capability_type', $pod['options'] ) && 0 < strlen( $capability_type ) ) {
					$capabilities[] = 'read_' . $capability_type;
					$capabilities[] = 'edit_' . $capability_type;
					$capabilities[] = 'delete_' . $capability_type;

					if ( 1 === (int) pods_v( 'capability_type_extra', $pod['options'], 1 ) ) {
						$capability_type_plural = $capability_type . 's';

						$capabilities[] = 'read_private_' . $capability_type_plural;
						$capabilities[] = 'edit_' . $capability_type_plural;
						$capabilities[] = 'edit_others_' . $capability_type_plural;
						$capabilities[] = 'edit_private_' . $capability_type_plural;
						$capabilities[] = 'edit_published_' . $capability_type_plural;
						$capabilities[] = 'publish_' . $capability_type_plural;
						$capabilities[] = 'delete_' . $capability_type_plural;
						$capabilities[] = 'delete_private_' . $capability_type_plural;
						$capabilities[] = 'delete_published_' . $capability_type_plural;
						$capabilities[] = 'delete_others_' . $capability_type_plural;
					}
				}
			} elseif ( 'taxonomy' === $pod['type'] ) {
				if ( 'custom' === pods_v( 'capability_type', $pod['options'], 'terms' ) ) {
					$capability_type = pods_v_sanitized( 'capability_type_custom', $pod['options'], pods_v( 'name', $pod ) . 's' );

					$capability_type       .= '_term';
					$capability_type_plural = $capability_type . 's';

					// Singular
					$capabilities[] = 'edit_' . $capability_type;
					$capabilities[] = 'delete_' . $capability_type;
					$capabilities[] = 'assign_' . $capability_type;
					// Plural
					$capabilities[] = 'manage_' . $capability_type_plural;
					$capabilities[] = 'edit_' . $capability_type_plural;
					$capabilities[] = 'delete_' . $capability_type_plural;
					$capabilities[] = 'assign_' . $capability_type_plural;
				}
			} else {
				$capabilities[] = 'pods_add_' . $pod['name'];
				$capabilities[] = 'pods_edit_' . $pod['name'];

				if ( isset( $pod['fields']['author'] ) && 'pick' === $pod['fields']['author']['type'] && 'user' === $pod['fields']['author']['pick_object'] ) {
					$capabilities[] = 'pods_edit_others_' . $pod['name'];
				}

				$capabilities[] = 'pods_delete_' . $pod['name'];

				if ( isset( $pod['fields']['author'] ) && 'pick' === $pod['fields']['author']['type'] && 'user' === $pod['fields']['author']['pick_object'] ) {
					$capabilities[] = 'pods_delete_others_' . $pod['name'];
				}

				$actions_enabled = pods_v( 'ui_actions_enabled', $pod['options'] );

				if ( ! empty( $actions_enabled ) ) {
					$actions_enabled = (array) $actions_enabled;
				} else {
					$actions_enabled = array();
				}

				$available_actions = array(
					'add',
					'edit',
					'duplicate',
					'delete',
					'reorder',
					'export',
				);

				if ( ! empty( $actions_enabled ) ) {
					$actions_disabled = array(
						'view' => 'view',
					);

					foreach ( $available_actions as $action ) {
						if ( ! in_array( $action, $actions_enabled, true ) ) {
							$actions_disabled[ $action ] = $action;
						}
					}

					if ( ! in_array( 'export', $actions_disabled, true ) ) {
						$capabilities[] = 'pods_export_' . $pod['name'];
					}

					if ( ! in_array( 'reorder', $actions_disabled, true ) ) {
						$capabilities[] = 'pods_reorder_' . $pod['name'];
					}
				} elseif ( 1 === (int) pods_v( 'ui_export', $pod['options'], 0 ) ) {
					$capabilities[] = 'pods_export_' . $pod['name'];
				}//end if
			}//end if
		}//end foreach

		return $capabilities;
	}
776762
def list_pods(self, namespace=None):
        

        if namespace:
            return [Pod(name=p.metadata.name, namespace=namespace, spec=p.spec)
                    for p in self.core_api.list_namespaced_pod(namespace, watch=False).items]

        return [Pod(name=p.metadata.name, namespace=p.metadata.namespace, spec=p.spec)
                for p in self.core_api.list_pod_for_all_namespaces(watch=False).items]
611038
public function getOptionIds(Attribute $attribute, $labels)
    {
        $optionIds = [];

        if (!is_array($labels)) {
            $labels = [$labels];
        }

        $options = $attribute->getSource()->getAllOptions();

        foreach ($labels as $label) {
            foreach ($options as $option) {
                if ($option['label'] == $label) {
                    $optionIds[] = (int) $option['value'];
                }
            }
        }

        return $optionIds;
    }
550200
public static function field_types() {

		$field_types = array(
			'text',
			'website',
			// 'link',
			'phone',
			'email',
			'password',
			'paragraph',
			'wysiwyg',
			'code',
			'datetime',
			'date',
			'time',
			'number',
			'currency',
			'file',
			'avatar',
			'oembed',
			'pick',
			'boolean',
			'color',
			'slug',
		);

		$field_types = array_merge( $field_types, array_keys( self::$field_types ) );

		$field_types = array_filter( array_unique( $field_types ) );

		$types = apply_filters( 'pods_api_field_types', $field_types );

		$field_types = pods_transient_get( 'pods_field_types' );

		if ( empty( $field_types ) || count( $types ) != count( $field_types ) ) {
			$field_types = array();

			foreach ( $types as $field_type ) {
				$file = null;

				if ( isset( self::$field_types[ $field_type ] ) ) {
					$file = self::$field_types[ $field_type ]['file'];
				}

				self::field_loader( $field_type, $file );

				if ( ! isset( self::$loaded[ $field_type ] ) || ! is_object( self::$loaded[ $field_type ] ) ) {
					continue;
				}

				$class_vars = get_class_vars( get_class( self::$loaded[ $field_type ] ) );
				// PHP 5.2.x workaround
				$field_types[ $field_type ]         = $class_vars;
				$field_types[ $field_type ]['file'] = $file;
			}

			self::$field_types = $field_types;

			pods_transient_set( 'pods_field_types', self::$field_types );
		} else {
			self::$field_types = array_merge( $field_types, self::$field_types );
		}//end if

		return self::$field_types;
	}
1194477
protected function render_fields_list($mode, $container = 'table', $row = 'tr', $label = 'td', $field = 'td', $tabs_block =
        'div', $tabs_head = 'ul', $tabs_row = 'li', $tabs_link = 'a', $tabs_content = 'div', $tabs_pane = 'div')
    {
        $out = '';
        $tabs_out = array();
        $raw_out = array();
        foreach ($this->fields_output as $key => $item)
        {
            $row_class = $this->theme_config('details_row');
            if ($this->primary_key == $item['name'])
            {
                $row_class .= ' primary';
            }
            if (isset($this->fields[$item['name']]['tab']) && $this->fields[$item['name']]['tab'])
            {
                $tabs_out[$this->fields[$item['name']]['tab']][] = $this->open_tag($row, $row_class) . $this->open_tag($label, $this->
                    theme_config('details_label_cell')) . $item['label'] . $this->get_field_tooltip($item['name'], $mode) . $this->
                    close_tag($label) . $this->open_tag($field, $this->theme_config('details_field_cell')) . $item['field'] . $this->
                    close_tag($field) . $this->close_tag($row);
            }
            else
            {
                $raw_out[] = $this->open_tag($row, $row_class) . $this->open_tag($label, $this->theme_config('details_label_cell')) . $item['label'] .
                    $this->get_field_tooltip($item['name'], $mode) . $this->close_tag($label) . $this->open_tag($field, $this->theme_config
                    ('details_field_cell')) . $item['field'] . $this->close_tag($field) . $this->close_tag($row);
            }
        }
        if (isset($this->field_tabs[$mode]) or $this->default_tab !== false)
        {
            $tabs_header = $this->open_tag($tabs_block, $this->theme_config('tabs_container'), array('class' => 'fruit-tabs')) . $this->
                open_tag($tabs_head, $this->theme_config('tabs_header_row'));
            $tabs_body = $this->open_tag($tabs_content, $this->theme_config('tabs_content'));
            $k = 0;

            if ($this->default_tab !== false && $raw_out)
            {
                $tabid = 'tabid_' . base_convert(rand(), 10, 36);
                $tabs_header .= $this->open_tag($tabs_row, $this->theme_config('tabs_header_cell') . ($k == 0 ? ' ' . $this->
                    theme_config('tabs_first_element') : '')) . $this->open_tag($tabs_link, $this->theme_config('tabs_header_link') . ($k ==
                    0 ? ' ' . $this->theme_config('tabs_first_element') : ''), array('href' => '#' . $tabid)) . $this->default_tab . $this->
                    close_tag($tabs_link) . $this->close_tag($tabs_row);
                $tabs_body .= $this->open_tag($tabs_pane, $this->theme_config('tabs_content_pane') . ($k == 0 ? ' ' . $this->
                    theme_config('tabs_first_element') : ''), array('id' => $tabid)) . $this->open_tag($container, $this->theme_config('details_container')) .
                    implode('', $raw_out) . $this->close_tag($container) . $this->close_tag($tabs_pane);
                ++$k;
                $raw_out = array();
            }

            if (isset($this->field_tabs[$mode]) && $tabs_out)
            {
                foreach ($this->field_tabs[$mode] as $key => $tabname)
                {
                    if (isset($tabs_out[$tabname]))
                    {
                        $tabid = 'tabid_' . base_convert(rand(), 10, 36);
                        $tabs_header .= $this->open_tag($tabs_row, $this->theme_config('tabs_header_cell') . ($k == 0 ? ' ' . $this->
                            theme_config('tabs_first_element') : '')) . $this->open_tag($tabs_link, $this->theme_config('tabs_header_link') . ($k ==
                            0 ? ' ' . $this->theme_config('tabs_first_element') : ''), array('href' => '#' . $tabid)) . $tabname . $this->close_tag($tabs_link) .
                            $this->close_tag($tabs_row);
                        $tabs_body .= $this->open_tag($tabs_pane, $this->theme_config('tabs_content_pane') . ($k == 0 ? ' ' . $this->
                            theme_config('tabs_first_element') : ''), array('id' => $tabid)) . $this->open_tag($container, $this->theme_config('details_container')) .
                            implode('', $tabs_out[$tabname]) . $this->close_tag($container) . $this->close_tag($tabs_pane);
                        ++$k;
                    }
                }
            }

            if ($this->nested_rendered && Fruit_config::$nested_in_tab)
            {
                foreach ($this->nested_rendered as $tabname => $content)
                {
                    $tabid = 'tabid_' . base_convert(rand(), 10, 36);
                    $tabs_header .= $this->open_tag($tabs_row, $this->theme_config('tabs_header_cell') . ($k == 0 ? ' ' . $this->
                        theme_config('tabs_first_element') : '')) . $this->open_tag($tabs_link, $this->theme_config('tabs_header_link') . ($k ==
                        0 ? ' ' . $this->theme_config('tabs_first_element') : ''), array('href' => '#' . $tabid)) . $tabname . $this->close_tag($tabs_link) .
                        $this->close_tag($tabs_row);
                    $tabs_body .= $this->open_tag($tabs_pane, $this->theme_config('tabs_content_pane') . ($k == 0 ? ' ' . $this->
                        theme_config('tabs_first_element') : ''), array('id' => $tabid)) . $content . $this->close_tag($tabs_pane);
                    ++$k;
                    unset($this->nested_rendered[$tabname]);
                }
            }

            $out .= $tabs_header . $this->close_tag($tabs_head) . $tabs_body . $this->close_tag($tabs_content) . $this->close_tag($tabs_block);
        }

        if ($raw_out)
        {
            $out .= $this->open_tag($container, $this->theme_config('details_container')) . implode('', $raw_out) . $this->
                close_tag($container);
        }
        //$out .= implode('', $this->hidden_fields_output);
        return $out;
    }
1202523
public function getFieldLayoutDefinition(FieldLayout $fieldLayout): array
    {
        if ($fieldLayout->getTabs()) {
            $tabDefinitions = [];

            foreach ($fieldLayout->getTabs() as $tab) {
                $tabDefinitions[$tab->name] = $this->getFieldLayoutFieldsDefinition($tab->getFields());
            }

            return [
                'type' => $fieldLayout->type,
                'tabs' => $tabDefinitions
            ];
        }

        return [
            'type' => $fieldLayout->type,
            'fields' => $this->getFieldLayoutFieldsDefinition($fieldLayout->getFields()),
        ];
    }
224008
public function getCMSFields()
    {
        // PHP 5.3 only
        $self = $this;
        $this->beforeUpdateCMSFields(function (FieldList $fields) use ($self) {
            $fields->removeFieldsFromTab(
                'Root.Main',
                array('KeyValuePairs', 'SortBy', 'SortByDirection')
            );
            // Don't put the GridField for documents in until the set has been created
            if (!$self->isInDB()) {
                $fields->addFieldToTab(
                    'Root.Main',
                    LiteralField::create(
                        'GridFieldNotice',
                        '<p class="message warning">' . _t(
                            'DMSDocumentSet.GRIDFIELD_NOTICE',
                            'Managing documents will be available once you have created this document set.'
                        ) . '</p>'
                    ),
                    'Title'
                );
            } else {
                $fields->removeByName('DocumentSetSort');
                // Document listing
                $gridFieldConfig = GridFieldConfig::create()
                    ->addComponents(
                        new GridFieldButtonRow('before'),
                        new GridFieldToolbarHeader(),
                        new GridFieldFilterHeader(),
                        new GridFieldSortableHeader(),
                        new GridFieldDataColumns(),
                        new DMSGridFieldEditButton(),
                        // Special delete dialog to handle custom behaviour of unlinking and deleting
                        new GridFieldDeleteAction(true),
                        new GridFieldDetailForm()
                    );

                if (class_exists('GridFieldPaginatorWithShowAll')) {
                    $paginatorComponent = new GridFieldPaginatorWithShowAll(15);
                } else {
                    $paginatorComponent = new GridFieldPaginator(15);
                }
                $gridFieldConfig->addComponent($paginatorComponent);

                if (class_exists('GridFieldSortableRows')) {
                    $gridFieldConfig->addComponent(new GridFieldSortableRows('DocumentSort'));
                } elseif (class_exists('GridFieldOrderableRows')) {
                    $gridFieldConfig->addComponent(new GridFieldOrderableRows('DocumentSort'));
                }

                // Don't show which page this is if we're already editing within a page context
                if (Controller::curr() instanceof CMSPageEditController) {
                    $fields->removeByName('PageID');
                } else {
                    $fields->fieldByName('Root.Main.PageID')->setTitle(_t('DMSDocumentSet.SHOWONPAGE', 'Show on page'));
                }

                // Don't show which page this is if we're already editing within a page context
                if (Controller::curr() instanceof CMSPageEditController) {
                    $fields->removeByName('PageID');
                } else {
                    $fields->fieldByName('Root.Main.PageID')->setTitle(_t('DMSDocumentSet.SHOWONPAGE', 'Show on page'));
                }

                $gridFieldConfig->getComponentByType('GridFieldDataColumns')
                    ->setDisplayFields($self->getDocumentDisplayFields())
                    ->setFieldCasting(array('LastEdited' => 'Datetime->Ago'))
                    ->setFieldFormatting(
                        array(
                            'FilenameWithoutID' => '<a target=\'_blank\' class=\'file-url\''
                                . ' href=\'$Link\'>$FilenameWithoutID</a>',
                            'ManuallyAdded' => function ($value) {
                                if ($value) {
                                    return _t('DMSDocumentSet.MANUAL', 'Manually');
                                }
                                return _t('DMSDocumentSet.QUERYBUILDER', 'Query Builder');
                            }
                        )
                    );

                // Override delete functionality with this class
                $gridFieldConfig->getComponentByType('GridFieldDetailForm')
                    ->setItemRequestClass('DMSGridFieldDetailForm_ItemRequest');
                $gridField = GridField::create(
                    'Documents',
                    false,
                    $self->Documents(),
                    $gridFieldConfig
                );
                $gridField->setModelClass('DMSDocument');
                $gridField->addExtraClass('documents');

                $gridFieldConfig->addComponent(
                    $addNewButton = new DMSGridFieldAddNewButton('buttons-before-left'),
                    'GridFieldExportButton'
                );
                $addNewButton->setDocumentSetId($self->ID);

                $fields->removeByName('Documents');
                $fields->addFieldsToTab(
                    'Root.Main',
                    array(
                        $gridField,
                        HiddenField::create('DMSShortcodeHandlerKey', false, DMS::inst()->getShortcodeHandlerKey())
                    )
                );
                $self->addQueryFields($fields);
            }
        });
        $this->addRequirements();
        return parent::getCMSFields();
    }
230177
public function getPods($storeName)
    {
        return (array_key_exists($storeName,$this->podConnections)) ? array_keys($this->podConnections[$storeName]) : [];
    }
1239546
protected function getFieldOptionsArray(FieldInterface $field)
    {
        $choices = [];
        $fieldOptions = $this->getFieldOptions($field);
        if (isset($fieldOptions['choices']) && is_array($fieldOptions['choices'])) {
            $choices = $fieldOptions['choices'];
        }
        return $choices;
    }