Get options for a field and setup defaults

@param null $fields
@param null $core_defaults
@param bool $single

@return array|null

@static
@since 2.0.0
760650
public static function fields_setup( $fields = null, $core_defaults = null, $single = false ) {

		if ( empty( $core_defaults ) ) {
			$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 ( $single ) {
			$fields = array( $fields );
		}

		foreach ( $fields as $f => $field ) {
			$fields[ $f ] = self::field_setup( $field, $core_defaults, pods_v( 'type', $field, 'text' ) );

			if ( ! $single && strlen( $fields[ $f ]['name'] ) < 1 ) {
				$fields[ $f ]['name'] = $f;
			}
		}

		if ( $single ) {
			$fields = $fields[0];
		}

		return $fields;
	}
992014
public function setField($field = null)
    {
        $this->field = null;

        if (!$field = $this->internalResolveField($field)) {
            $this->field = $this->fieldId = null;
        } else {
            $this->fieldId = $field->id;
            $this->field = $field;
        }

        return $this;
    }
1288813
public function getDefaultOptions()
    {
        if (! $this->defaults) {
            return null;
        }

        if ($this->defaults instanceof ConfigInterface) {
            return $this->defaults->getArrayCopy();
        }

        return (array)$this->defaults;
    }
1006461
protected function setDefaultFieldOptions() : void
    {
        $table = $this->config->getTable();
        $field = $this->config->getField();

        $mc = new ModuleConfig(ConfigType::FIELDS(), Inflector::camelize($table->getTable()));
        $config = $mc->parseToArray();
        if (! empty($config[$field])) {
            $this->defaultOptions = array_replace_recursive($this->defaultOptions, $config[$field]);
        }
    }
570575
public static function core(Core $core = NULL)
    {
        if ($core)
        {
            static::$core = $core;
        }

        else if (static::$core === NULL)
        {
            static::init();
        }

        return static::$core;
    }
426755
public static function getFieldOptions($field, $optionKey = false)
    {
        if ($optionKey) {
            return static::$_classFields[get_called_class()][$field][$optionKey];
        } else {
            return static::$_classFields[get_called_class()][$field];
        }
    }
610459
protected function setDefaults($sets = array())
    {
        foreach ($sets as $set) {
            foreach ($set as $field => $fieldParams) {
                if ($fieldParams['type'] == 'single' && isset($fieldParams['default'])) {
                    $this->fieldData[$field] = $fieldParams['default'];
                }
            }
        }
    }
1268536
public static function setSimpleFloatFields(
        array $fields,
        ClassMetadataBuilder $builder,
        $default = null
    ): void {
        if (null !== $default && !\is_float($default)) {
            throw new \InvalidArgumentException(
                'Invalid default value ' . $default
                . ' with type ' . self::getType($default)
            );
        }
        foreach ($fields as $field) {
            $fieldBuilder = new FieldBuilder(
                $builder,
                [
                    'fieldName' => $field,
                    'type'      => Type::FLOAT,
                    'default'   => $default,
                ]
            );
            $fieldBuilder
                ->columnName(self::getColumnNameForField($field))
                ->nullable(null === $default)
                ->build();
        }
    }
1267414
protected function mutateValue(array $mutators, string $field, $default)
    {
        //Let's process default value using associated setter
        if (isset($mutators[RecordEntity::MUTATOR_SETTER][$field])) {
            try {
                $setter = $mutators[RecordEntity::MUTATOR_SETTER][$field];
                $default = call_user_func($setter, $default);

                return $default;
            } catch (\Exception $exception) {
                //Unable to generate default value, use null or empty array as fallback
            }
        }

        if (isset($mutators[RecordEntity::MUTATOR_ACCESSOR][$field])) {
            $default = $this->accessorDefault(
                $default,
                $mutators[RecordEntity::MUTATOR_ACCESSOR][$field]
            );

            return $default;
        }

        return $default;
    }
1229359
public static function option($bundle, $option, $default = null)
	{
		$bundle = static::get($bundle);

		if (is_null($bundle))
		{
			return value($default);
		}

		return array_get($bundle, $option, $default);
	}
797288
public function options($key = null, $default = null)
    {
        $option = $this->getParameter('options', new Collection());

        if ($key == null) {
            return $option;
        }

        return $option->get($key, $default);
    }
1355372
public static function option($bundle, $option, $default = null)
		{
			$bundle = static::get($bundle);

			if (is_null($bundle)) {
				return value($default);
			}

			return arrayGet($bundle, $option, $default);
		}
1316387
public function error($field = null, $default = false)
	{
		if ($field === null)
		{
			return $this->errors;
		}

		return array_key_exists($field, $this->errors) ? $this->errors[$field] : $default;
	}
548658
public function getOptions()
    {
        return [
            ['fieldsFile', null, InputOption::VALUE_REQUIRED, 'Fields input as json file'],
            ['jsonFromGUI', null, InputOption::VALUE_REQUIRED, 'Direct Json string while using GUI interface'],
            ['plural', null, InputOption::VALUE_REQUIRED, 'Plural Model name'],
            ['tableName', null, InputOption::VALUE_REQUIRED, 'Table Name'],
            ['fromTable', null, InputOption::VALUE_NONE, 'Generate from existing table'],
            ['ignoreFields', null, InputOption::VALUE_REQUIRED, 'Ignore fields while generating from table'],
            ['save', null, InputOption::VALUE_NONE, 'Save model schema to file'],
            ['primary', null, InputOption::VALUE_REQUIRED, 'Custom primary key'],
            ['prefix', null, InputOption::VALUE_REQUIRED, 'Prefix for all files'],
            ['paginate', null, InputOption::VALUE_REQUIRED, 'Pagination for index.blade.php'],
            ['skip', null, InputOption::VALUE_REQUIRED, 'Skip Specific Items to Generate (migration,model,controllers,api_controller,scaffold_controller,repository,requests,api_requests,scaffold_requests,routes,api_routes,scaffold_routes,views,tests,menu,dump-autoload)'],
            ['datatables', null, InputOption::VALUE_REQUIRED, 'Override datatables settings'],
            ['views', null, InputOption::VALUE_REQUIRED, 'Specify only the views you want generated: index,create,edit,show'],
            ['relations', null, InputOption::VALUE_NONE, 'Specify if you want to pass relationships for fields'],
            ['softDelete', null, InputOption::VALUE_NONE, 'Soft Delete Option'],
            ['forceMigrate', null, InputOption::VALUE_NONE, 'Specify if you want to run migration or not'],
        ];
    }
354377
public function get($field, $default = null)
	{
		if (isset($this->user[$field]))
		{
			return $this->user[$field];
		}
		elseif (isset($this->user['profile_fields']))
		{
			return $this->get_profile_fields($field, $default);
		}

		return $default;
	}
690738
public function get_data($field = null, $default = null) {
		if($field === null) return $this->data;
		return array_key_exists($field, $this->data) ? $this->data[$field] : $default;
	}
24426
function fieldconfigurer($fieldtype = null) {
		$fieldtype !== null or $fieldtype = 'field';
		if ($this->fieldconfigurers !== null) {
			if (isset($this->fieldconfigurers[$fieldtype])) {
				return $this->fieldconfigurers[$fieldtype];
			}
			else if (isset($this->fieldconfigurers['field'])) {
				return $this->fieldconfigurers['field'];
			}
		}

		return null; # no configurer
	}