Get Admin options for a field type and setup defaults

@static

@param $type

@return array|null

@since 2.0.0
181013
public static function ui_options( $type ) {

		$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(),
		);

		self::field_loader( $type );

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

		$first_field = current( $options );

		if ( ! empty( $options ) && ! isset( $first_field['name'] ) && ! isset( $first_field['label'] ) ) {
			foreach ( $options as $group => $group_options ) {
				$options[ $group ] = self::fields_setup( $group_options, $core_defaults );
			}
		} else {
			$options = self::fields_setup( $options, $core_defaults );
		}

		return $options;
	}
726924
public function type($type = null)
    {
        if ($type !== null) {
            $this->type = $type;
            return $this;
        }
        return $this->type;
    }
604442
public function all($type = null)
    {
        return array_filter(
            $this->bag,
            /** @var BuilderInterface $builder */
            function (BuilderInterface $builder) use ($type) {
                return $type === null || $builder->getType() == $type;
            }
        );
    }
528208
public function getType($type)
    {
        $aliases = array(
            'int'    => 'integer',
            'bool'   => 'boolean',
            'double' => 'float',
            'object' => '\\stdClass'
        );
        $default = array(
            'integer', 'boolean', 'float', '\\stdClass', 'callable', 'string', 'resource', 'void', 'mixed'
        );
        $typeHintEnabled = false;

        if (isset($aliases[$type])) {
            $type = $aliases[$type];
        }

        if (!in_array($type, $default)) {
            $typeHintEnabled = true;
        }

        return array(
            'name' => $type,
            'hint' => $typeHintEnabled
        );
    }
171573
private function getDefaultOptions(InputTypeInterface $type)
    {
        return array_merge([
            'force' => false,
            'property' => '',
            'constraints' => null,
            'required' => false,
            'default' => null,
            'modify' => null,
        ], $type->getDefaultOptions());
    }
1122212
protected function getSearchableColumns($type)
    {
        $fields = $this->config->get('contenttypes/' . $type . '/fields');

        foreach ($fields as $field => $options) {
            if (in_array($options['type'], ['text', 'textarea', 'html', 'markdown']) ||
                (isset($options['searchable']) && $options['searchable'] === true)) {
                if (isset($options['searchweight'])) {
                    $weight = (int) $options['searchweight'];
                } elseif (isset($fields['slug']['uses']) && in_array($field, (array)$fields['slug']['uses'], true)) {
                    $weight = 100;
                } else {
                    $weight = 50;
                }

                if (!$this->isInvisible($type)) {
                    $this->searchableTypes[$type][$field] = ['weight' => $weight];
                } else {
                    $this->invisibleTypes[$type][$field] = ['weight' => $weight];
                }
            }
        }
    }
414566
protected function useHeadersFromType($type=null)
	{
		$defaultHeaders['json'] = array(
			'Accept:application/json',
			'Content-Type:application/json',
		);
		$defaultHeaders['xml'] = array(
			'Accept:application/xml',
			'Content-Type:application/xml',
		);
		$defaultHeaders['custom'] = null;
		if(!isset($type) OR !isset($defaultHeaders[$type]))
		{
			$this->resource = 'custom';
			return $defaultHeaders[$this->defaultResource];
		}
		$this->resource = $type;
		return $defaultHeaders[$type];
	}
820921
public static function getFieldClass($type)
    {
        $config = b8\Config::getInstance();

        $try = '\\' . $config->get('site.namespace') . '\\Form\\Element\\' . $type;

        if (class_exists($try)) {
            return $try;
        }

        $try = '\\Octo\\Form\\Element\\' . $type;

        if (class_exists($try)) {
            return $try;
        }

        $try = '\\b8\\Form\\Element\\' . $type;

        if (class_exists($try)) {
            return $try;
        }

        return null;
    }
1332399
public function options(string $id_option = null, string $type = 'page'): ?array
  {
    if (
      ($id_option = $this->_get_id_option($id_option, $type)) &&
      ($os = $this->opt->options(\func_get_args()))
    ){
      $res = [];
      foreach ( $os as $o ){
        if ( $this->pref->has($o['id']) ){
          $res[] = $o;
        }
      }
      return $res;
    }
    return null;
  }
674925
private function resolveTypes($type)
    {
        $actionTypes = [];

        do {
            $actionTypes[] = $actionType = $this->actionRegistry[$type];
        } while (($type = $actionType->getParent()) !== null);

        return $actionTypes;
    }
867339
protected function getAllowedFields(string $type): array
    {
        \assert($this->hasFilter($type) === true);

        return $this->fieldSets[$type];
    }
797679
public static function getFilter(string $type): array
    {
        return isset(self::$filters[$type]) ? self::$filters[$type] : [];
    }
481883
public function getValues($type = null)
    {
        if ($type == null) {
            return $this->values;
        }

        $converter  = $this->converterFactory->getConverter($type);
        $resultList = [];

        foreach ($this->values as $riakObject) {
            $reference = new RiakObjectReference($riakObject, $this->location, $type);
            $converted = $converter->toDomain($reference);

            $resultList[] = $converted;
        }

        return new DomainObjectList($resultList);
    }
641018
public function add_install_settings_fields( $type ) {
		if ( ( empty( static::$options['bitbucket_username'] ) ||
			empty( static::$options['bitbucket_password'] ) ) ||

			( empty( static::$options['bitbucket_server_username'] ) ||
			empty( static::$options['bitbucket_server_password'] ) )
		) {
			add_settings_field(
				'bitbucket_username',
				esc_html__( 'Bitbucket Username', 'github-updater' ),
				[ $this, 'bitbucket_username' ],
				'github_updater_install_' . $type,
				$type
			);

			add_settings_field(
				'bitbucket_password',
				esc_html__( 'Bitbucket Password', 'github-updater' ),
				[ $this, 'bitbucket_password' ],
				'github_updater_install_' . $type,
				$type
			);
		}

		add_settings_field(
			'is_private',
			esc_html__( 'Private Bitbucket Repository', 'github-updater' ),
			[ $this, 'is_private_repo' ],
			'github_updater_install_' . $type,
			$type
		);
	}
651344
public function getMessages($type)
    {
        return $this->hasMessages($type)
            ? $_SESSION[$this->alias][$type]
            : null;
    }
168549
protected function getPermissionField($type)
    {
        switch ($type) {
            case self::DELETE:
                // Delete uses edit type - Drop through
            case self::EDIT:
                return 'CanEditType';
            case self::VIEW:
                return 'CanViewType';
            default:
                throw new InvalidArgumentException("Invalid argument type $type");
        }
    }
359729
protected function set_defaults( $type ) {
		if ( ! isset( self::$options['branch_switch'] ) ) {
			self::$options['branch_switch'] = null;
		}

		if ( ! isset( $this->$type->slug ) ) {
			$this->$type       = new \stdClass();
			$this->$type->slug = null;
		} elseif ( ! isset( self::$options[ $this->$type->slug ] ) ) {
			self::$options[ $this->$type->slug ] = null;
			add_site_option( 'github_updater', self::$options );
		}

		$this->$type->remote_version = '0.0.0';
		$this->$type->newest_tag     = '0.0.0';
		$this->$type->download_link  = null;
		$this->$type->tags           = [];
		$this->$type->rollback       = [];
		$this->$type->branches       = [];
		$this->$type->requires       = null;
		$this->$type->tested         = null;
		$this->$type->donate_link    = null;
		$this->$type->contributors   = [];
		$this->$type->downloaded     = 0;
		$this->$type->last_updated   = null;
		$this->$type->rating         = 0;
		$this->$type->num_ratings    = 0;
		$this->$type->transient      = [];
		$this->$type->repo_meta      = [];
		$this->$type->watchers       = 0;
		$this->$type->forks          = 0;
		$this->$type->open_issues    = 0;
		$this->$type->requires       = false;
		$this->$type->requires_php   = false;
	}