Post type options

@since 0.9
@return array Options for post type field
327863
function ctc_post_type_options() {

		$options = array();

		// Get supported post types with archives
		$post_types = get_post_types( array(
			'public'		=> true,
			'show_ui'		=> true, // theme support or plugin settings may set false
			'has_archive'	=> true
		), 'objects' );

		// Loop post types
		foreach ( $post_types as $post_type_slug => $post_type_object ) {

			$post_type_name = $post_type_object->labels->name;

			// Add to array
			$options[$post_type_slug] = $post_type_name;

		}

		// Add blog post type with special name (has_archive excludes it)
		$options = array_merge(
			array(
				'post' => _x( 'Blog', 'archives widget', 'church-theme-framework' )
			),
			$options
		);

		// Return filtered
		return apply_filters( 'ctc_archives_widget_post_type_options', $options );

	}
394556
public function getFieldOptions()
    {
        $options = $this->formField->options();

        if (!$options && $this->mode === static::MODE_RELATION) {
            $options = $this->getRelationModel()->lists($this->nameFrom);
        }

        return $options;
    }
834593
public function postTypeColumns()
    {
        $postTypes = get_post_types();

        foreach ($postTypes as $postType) {
            add_filter('manage_' . $postType . '_posts_columns', function ($columns) {
                broken_link_detector_array_splice_assoc($columns, -1, 0, array(
                    'broken-links' => __('Broken links', 'broken-links-detector')
                ));

                return $columns;
            }, 50);

            add_filter('manage_edit-' . $postType . '_sortable_columns', function ($columns) {
                $columns['broken-links'] = 'broken-links';
                return $columns;
            }, 50);

            add_action('manage_' . $postType . '_posts_custom_column', function ($column, $postId) {
                if ($column !== 'broken-links') {
                    return;
                }

                $links = \BrokenLinkDetector\ListTable::getBrokenLinksCount($postId);

                if ($links > 0) {
                    echo '<span class="broken-link-detector-label">' . $links . '</span>';
                } else {
                    echo '<span aria-hidden="true">—</span>';
                }
            }, 20, 2);
        }
    }
960874
protected function getOptions()
    {
        $baseOptions = [
            ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'],
        ];

        return array_merge($baseOptions, isset($this->options) ? $this->options : []);
    }
849276
public function getPostFields()
    {
        $this->validate();
        $mappedFields = $this->getMappedFields();
        $this->paymentMethod->addAdditionalFields($mappedFields);
        return $mappedFields;
    }
1045460
protected function getClientOptions()
    {
        $options = [
            'encodeErrorSummary' => $this->encodeErrorSummary,
            'errorSummary' => '.' . implode('.', preg_split('/\s+/', $this->errorSummaryCssClass, -1, PREG_SPLIT_NO_EMPTY)),
            'validateOnSubmit' => $this->validateOnSubmit,
            'errorCssClass' => $this->errorCssClass,
            'successCssClass' => $this->successCssClass,
            'validatingCssClass' => $this->validatingCssClass,
            'ajaxParam' => $this->ajaxParam,
            'ajaxDataType' => $this->ajaxDataType,
            'scrollToError' => $this->scrollToError,
        ];
        if ($this->validationUrl !== null) {
            $options['validationUrl'] = Url::to($this->validationUrl);
        }

        // only get the options that are different from the default ones (set in yii.activeForm.js)
        return array_diff_assoc($options, [
            'encodeErrorSummary' => true,
            'errorSummary' => '.error-summary',
            'validateOnSubmit' => true,
            'errorCssClass' => 'has-error',
            'successCssClass' => 'has-success',
            'validatingCssClass' => 'validating',
            'ajaxParam' => 'ajax',
            'ajaxDataType' => 'json',
            'scrollToError' => true,
        ]);
    }
1046023
protected function getOptions()
    {
        return array(
          array('filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file', $this->filename),
          array('dir', 'D', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The model dir', array()),
          array('write', 'W', InputOption::VALUE_NONE, 'Write to Model file'),
          array('nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'),
          array('reset', 'R', InputOption::VALUE_NONE, 'Remove the original phpdocs instead of appending'),
          array('smart-reset', 'r', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'),
          array('ignore', 'I', InputOption::VALUE_OPTIONAL, 'Which models to ignore', ''),
        );
    }
1204228
protected function getCurlOptions(): array
    {
        $options = [];

        $options[CURLOPT_RETURNTRANSFER] = true;
        $options[CURLOPT_HEADER] = true;

        foreach ($this->getOptions() as $option => $value) {
            $options[$option] = $value;
        }

        switch ($this->getMethod()) {
            case self::POST:
                if (!$this->hasOption(CURLOPT_CUSTOMREQUEST)) {
                    $options[CURLOPT_CUSTOMREQUEST] = $this->getMethod();
                }

                if (!$this->hasOption(CURLOPT_POSTFIELDS)) {
                    $options[CURLOPT_POSTFIELDS] = count($this->getParams()) > 0 ? http_build_query($this->getParams()) : '';
                }

                if ($this->hasHeader('Content-Type') && $this->getHeader('Content-Type') == 'application/json') {
                    $options[CURLOPT_POSTFIELDS] = Json::encode($this->getParams());
                }
                break;

            case self::PUT:
            case self::DELETE:
                if (!$this->hasOption(CURLOPT_CUSTOMREQUEST)) {
                    $options[CURLOPT_CUSTOMREQUEST] = $this->getMethod();
                }

                if (!$this->hasOption(CURLOPT_POSTFIELDS)) {
                    $options[CURLOPT_POSTFIELDS] = count($this->params) > 0 ? http_build_query($this->params) : '';
                }
                break;
        }

        if (count($this->headers) > 0) {
            $options[CURLOPT_HTTPHEADER] = $this->getPreparedHeaders();
        }

        return $options;
    }
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;
	}
1181161
protected function getOptions()
    {
        return [
            ['namespace', 'ns', InputOption::VALUE_OPTIONAL, 'Namespace for entity and its closure.'],
            ['entity', 'e', InputOption::VALUE_REQUIRED, 'Entity class name.'],
            ['entity-table', 'et', InputOption::VALUE_OPTIONAL, 'Entity table name.'],
            ['closure', 'c', InputOption::VALUE_OPTIONAL, 'Closure class name'],
            ['closure-table', 'ct', InputOption::VALUE_OPTIONAL, 'Closure table name.'],
            ['models-path', 'mdl', InputOption::VALUE_OPTIONAL, 'Models path.'],
            ['migrations-path', 'mgr', InputOption::VALUE_OPTIONAL, 'Migrations path.'],
            ['use-innodb', 'i', InputOption::VALUE_OPTIONAL, 'Use InnoDB tables.'],
        ];
    }
344135
public function listFieldTypesOptions() {
    $field_types_data = $this->loadFieldTypeData();

    $return = [];
    foreach ($field_types_data as $field_type_id => $field_type_info) {
      $return[$field_type_id] = $field_type_info['label'];
    }

    return $return;
  }
446850
public function post_type_support() {

		/**
		 * Filter the post types that allow layouts.
		 *
		 * @since 1.0.0
		 *
		 * @var array
		 */
		$post_types = (array) apply_filters( 'rock_layouts_post_types', get_post_types( array( 'public' => true ) ) );

		foreach ( $post_types as $post_type ) {

			add_post_type_support( $post_type, 'rock-layouts' );

		}

	}
192676
public static function dataTypeSelectOptions()
    {
        return [
            Property::DATA_TYPE_STRING => Module::t('app', 'String'),
            Property::DATA_TYPE_TEXT => Module::t('app', 'Text'),
            Property::DATA_TYPE_INTEGER => Module::t('app', 'Integer'),
            Property::DATA_TYPE_FLOAT => Module::t('app', 'Float'),
            Property::DATA_TYPE_BOOLEAN => Module::t('app', 'Boolean'),
            Property::DATA_TYPE_PACKED_JSON => Module::t('app', 'Packed JSON'),
            Property::DATA_TYPE_INVARIANT_STRING => Module::t('app', 'Untranslatable String'),
        ];
    }
680292
public function getSubtypeOptions() {
		$types = get_registered_entity_types();
		$types = elgg_trigger_plugin_hook('search_types', 'get_queries', [], $types);

		return elgg_extract($this->getEntityType(), $types);
	}
1355176
protected function getOptions()
    {
        return [
            ['database', 'db', InputOption::VALUE_REQUIRED, 'The database connection to use.', $this->defaultDatabase],
            ['name', null, InputOption::VALUE_REQUIRED, 'the custom name for the primary index.', '#primary'],
            [
                'ignore',
                'ig',
                InputOption::VALUE_NONE,
                'if a primary index already exists, an exception will be thrown unless this is set to true.',
            ],
        ];
    }
240569
public function getOptions() {

		$options = $this->options;

		unset($options['type']);
		$options['types'] = [$this->getEntityType()];

		$filters = $this->filters;
		if (!empty($filters)) {
			foreach ($filters as $filter) {
				$name = $filter['filter'];
				$target = $filter['target'];
				$options = $this->addFilterQuery($options, $name, $target);
			}
		}

		$sorts = $this->sorts;
		if (empty($sorts)) {
			$sorts[] = [
				'field' => 'time_created',
				'direction' => 'DESC',
			];
		}

		foreach ($sorts as $sort) {
			$field = $sort['field'];
			$direction = $sort['direction'];
			$options = $this->addSortQuery($options, $field, $direction);
		}

		if ($this->search_query) {
			$options = $this->addSearchQuery($options, $this->search_query, $this->search_options);
		}

		if ($this->search_query || !empty($this->filters)) {
			if (!isset($options['no_results'])) {
				$options['no_results'] = elgg_echo('sort:search:empty');
			}
		}

		return $options;
	}
604317
protected function getOptions()
	{
		$options = array();

		/** @var \SimpleXMLElement $option */
		foreach ($this->element->children() as $option)
		{
			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			$text = $this->translateOptions
				? $this->getText()->alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))
				: trim((string) $option);

			// Set up option elements.
			$tmp = new stdClass;
			$tmp->value = (string) $option['value'];
			$tmp->text = $text;
			$tmp->disable = ((string) $option['disabled'] == 'true');
			$tmp->class = (string) $option['class'];
			$tmp->onclick = (string) $option['onclick'];

			// Add the option object to the result set.
			$options[] = $tmp;
		}

		reset($options);

		return $options;
	}