getCustomFields

Return a list of custom methods with has() accessor.

@access  private
@return  array
966077
private function getCustomFields()
    {
        if (static::$has_methods === null) {
            static::fillHasMethods($this);
        }

        $custom_fields = [];

        foreach (static::$has_methods as $method) {
            if (call_user_func([$this, sprintf("has%s", $method)]) === true) {
                $custom_fields[Inflector::underscore(lcfirst($method))] = call_user_func([$this, sprintf("get%s", $method)]);
            }
        }

        return $custom_fields;
    }
334169
public function getPersistentFields()
    {
        if (empty($this->persistentFields)) {

            $persistentFields = $this->getPropertyContainer()->getFields('hasMany');
            if (!empty($persistentFields)) {
                $persistentFields = array_filter(
                    $persistentFields,
                    function (PropertyContract $property) {
                        if (!$property->getBehavior()->isPersistent()) {
                            return false;
                        }

                        if (!$property->getBehavior() instanceof IntegerBehavior) {
                            return true;
                        }

                        if ($property->getBehavior()->getIncrementalBehavior() == 'database') {
                            return false;
                        }

                        return true;
                    }
                );
            }
            $this->persistentFields = $persistentFields;
        }

        return $this->persistentFields;
    }
324712
private function getOauthFields()
    {
        $this->oAuthFields = [
            'grant_type' => 'client_credentials',
            'scope' => $this->scope,
            'client_secret' => $this->mpClientSecret,
            'client_id' => $this->mpClientId,
        ];

        $this->fieldCount = count($this->oAuthFields);

        return $this->oAuthFields;
    }
509674
public function getCMSFields()
    {
        $fields = $this->scaffoldFormFields(
            array(
                // Don't allow has_many/many_many relationship editing before the record is first saved
                'includeRelations' => ($this->ID > 0),
                'tabbed' => true,
                'ajaxSafe' => true
            )
        );
        $fields->removeByName(
            array(
                'Title',
                'Instance',
                'Style',
                'Objects'
            )
        );
        if (!$this->IsMain) {
            $fields->addFieldsToTab(
                'Root.Main',
                array(
                    TextField::create(
                        'Title',
                        _t('PlaceableObject_Preset.TITLE', 'Title')
                    ),
                    DropdownField::create(
                        'Instance',
                        _t('PlaceableObject_Preset.INSTANCE', 'Instance'),
                        singleton('PlaceableObject_Preset')->dbObject('Instance')->enumValues()
                    )
                )
            );
        }
        if ($this->Styles) {
            $fields->addFieldToTab(
                'Root.Main',
                DropdownField::create(
                    'Style',
                    _t('PlaceableObject_Preset.STYLE', 'Style'),
                    $this->Styles
                )->setEmptyString(_t('PlaceableObject_Preset.DEFAULTSTYLE', 'Default'))
            );
        }
        $fields->addFieldsToTab(
            'Root.Objects',
            array(
                LabelField::create(
                    'ObjectsDescription',
                    _t('PlaceableObject_Preset.OBJECTSDESCRIPTION', 'List of all objects that use this use this preset.')
                ),
                GridField::create(
                    'Objects',
                    _t('PlaceableObject_Preset.OBJECTS', 'Objects'),
                    $this->Objects(),
                    GridFieldConfig_Base::create()
                )
            )
        );
        $this->extend('updateCMSFields', $fields);
        return $fields;
    }
510652
protected function getFields(): ?array
    {
        $fields = $this->requestStack->getCurrentRequest()->get('fields');

        if (!is_null($fields)) {
            $fields = array_map('trim', explode(',', $fields));
        }

        return $fields;
    }
189410
protected function getFormFields()
    {
        $fields = FieldList::create();

        $controller = $this->getController();
        $backURL = $controller->getBackURL()
            ?: $controller->getReturnReferer();

        // Protect against infinite redirection back to the logout URL after logging out
        if (!$backURL || Director::makeRelative($backURL) === $controller->getRequest()->getURL()) {
            $backURL = Director::baseURL();
        }

        $fields->push(HiddenField::create('BackURL', 'BackURL', $backURL));

        return $fields;
    }
119018
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                $image = UploadField::create(
                    'Image',
                    $this->fieldLabel('Image')
                ),
                HTMLEditorField::create(
                    'Caption',
                    $this->fieldLabel('Caption')
                )->setRows(10),
                TextField::create(
                    'ImageTitle',
                    $this->fieldLabel('ImageTitle')
                ),
                TextField::create(
                    'ImageAlt',
                    $this->fieldLabel('ImageAlt')
                )
            ]
        );
        
        // Define Image Field:
        
        $image->setAllowedExtensions(['gif', 'jpg', 'jpeg', 'png', 'svg']);
        $image->setFolderName($this->getAssetFolder());
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'ImageOptions',
                $this->fieldLabel('ImageOptions'),
                [
                    CheckboxField::create(
                        'LinkImage',
                        $this->fieldLabel('LinkImage')
                    ),
                    CheckboxField::create(
                        'HideCaption',
                        $this->fieldLabel('HideCaption')
                    ),
                    CheckboxField::create(
                        'InlineVector',
                        $this->fieldLabel('InlineVector')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
899568
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                FieldSection::create(
                    'HeadingSection',
                    $this->fieldLabel('HeadingSection'),
                    [
                        TextField::create(
                            'Heading',
                            $this->fieldLabel('Heading')
                        ),
                        TextField::create(
                            'SubHeading',
                            $this->fieldLabel('SubHeading')
                        )
                    ]
                ),
                UploadField::create(
                    'Image',
                    $this->fieldLabel('Image')
                )->setAllowedFileCategories('image')->setFolderName($this->getAssetFolder()),
                HTMLEditorField::create(
                    'Summary',
                    $this->fieldLabel('Summary')
                )
            ]
        );
        
        // Define Placeholder:
        
        $placeholder = _t(__CLASS__ . '.DROPDOWNDEFAULT', '(default)');
        
        // Create Style Fields:
        
        $fields->addFieldToTab(
            'Root.Style',
            FieldSection::create(
                'FeatureStyle',
                $this->fieldLabel('FeatureStyle'),
                [
                    DropdownField::create(
                        'HeadingLevel',
                        $this->fieldLabel('HeadingLevel'),
                        $this->getTitleLevelOptions()
                    )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder),
                ]
            )
        );
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'FeatureOptions',
                $this->fieldLabel('FeatureOptions'),
                [
                    CheckboxField::create(
                        'ShowIcon',
                        $this->fieldLabel('ShowIcon')
                    ),
                    CheckboxField::create(
                        'ShowImage',
                        $this->fieldLabel('ShowImage')
                    ),
                    CheckboxField::create(
                        'ShowHeader',
                        $this->fieldLabel('ShowHeader')
                    ),
                    CheckboxField::create(
                        'ShowSummary',
                        $this->fieldLabel('ShowSummary')
                    ),
                    CheckboxField::create(
                        'ShowFooter',
                        $this->fieldLabel('ShowFooter')
                    ),
                    CheckboxField::create(
                        'LinkHeading',
                        $this->fieldLabel('LinkHeading')
                    ),
                    CheckboxField::create(
                        'LinkFeature',
                        $this->fieldLabel('LinkFeature')
                    ),
                    CheckboxField::create(
                        'LinkImage',
                        $this->fieldLabel('LinkImage')
                    ),
                    TextField::create(
                        'ButtonLabel',
                        $this->fieldLabel('ButtonLabel')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
1189394
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Style Fields:
        
        $fields->addFieldsToTab(
            'Root.Style',
            [
                FieldSection::create(
                    'NavigationStyle',
                    $this->fieldLabel('NavigationStyle'),
                    [
                        TextField::create(
                            'ButtonMargin',
                            $this->fieldLabel('ButtonMargin')
                        ),
                        TextField::create(
                            'ButtonPaddingX',
                            $this->fieldLabel('ButtonPaddingX')
                        ),
                        TextField::create(
                            'ButtonPaddingY',
                            $this->fieldLabel('ButtonPaddingY')
                        )
                    ]
                )
            ]
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
883555
protected function getFormListFieldsConfiguration()
    {
        return collect($this->fields)
            ->filter(function($field) {
                return $field instanceof SharpFormListField
                    && $field->isSortable();

            })->map(function($listField) {
                return [
                    "key" => $listField->key(),
                    "orderAttribute" => $listField->orderAttribute()
                ];

            })->keyBy("key");
    }
1059061
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'NavigationOptions',
                $this->fieldLabel('NavigationOptions'),
                [
                    CheckboxField::create(
                        'HideTopLevel',
                        $this->fieldLabel('HideTopLevel')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
866651
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Remove Field Objects:
        
        $fields->fieldByName('Root')->removeByName('Style');
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                CheckboxSetField::create(
                    'Areas',
                    $this->fieldLabel('Areas'),
                    AreaComponent::get()->map()
                )
            ]
        );
        
        // Insert Show On Field (within folder only):
        
        if ($this->getParent() instanceof PanelFolder) {
            
            $fields->insertAfter(
                SelectionGroup::create(
                    'ShowOn',
                    [
                        SelectionGroup_Item::create(
                            'AllPages',
                            null,
                            $this->fieldLabel('AllPages')
                        ),
                        SelectionGroup_Item::create(
                            'OnlyThesePages',
                            PageMultiselectField::create('Pages', ''),
                            $this->fieldLabel('OnlyThesePages')
                        )
                    ]
                )->setTitle($this->fieldLabel('ShowOn')),
                'Areas'
            );
            
        }
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'PanelOptions',
                $this->fieldLabel('PanelOptions'),
                [
                    CheckboxField::create(
                        'DoNotInherit',
                        $this->fieldLabel('DoNotInherit')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
1030369
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Style Fields:
        
        $fields->addFieldsToTab(
            'Root.Style',
            [
                FieldSection::create(
                    'NavigationStyle',
                    $this->fieldLabel('NavigationStyle'),
                    [
                        DropdownField::create(
                            'IconSize',
                            $this->fieldLabel('IconSize'),
                            Link::singleton()->getIconSizeOptions()
                        ),
                        NumericField::create(
                            'IconMargin',
                            $this->fieldLabel('IconMargin')
                        )
                    ]
                )
            ]
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
359500
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'RowOptions',
                $this->fieldLabel('RowOptions'),
                [
                    CheckboxField::create(
                        'NoGutters',
                        $this->fieldLabel('NoGutters')
                    ),
                    CheckboxField::create(
                        'UseContainer',
                        $this->fieldLabel('UseContainer')
                    ),
                    CheckboxField::create(
                        'EdgeToEdge',
                        $this->fieldLabel('EdgeToEdge')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
652937
public function hasFields()
    {
        if ($this->hasProperty()) {
            $property = $this->property();
            if ($property instanceof StorablePropertyInterface) {
                return (count($property->fieldNames()) > 0);
            } else {
                return true;
            }
        }

        return false;
    }
492884
private function getFields()
    {
        $fields = [];

        foreach ($this->items as $name => $field) {
            if (is_array($field) && isset($field['name'])) {
                $fields[] = $field['name'];
            } else if ($field instanceof FillableField){
                $fields[] = $field->name;
            } else if (is_string($name)){
                $fields[] = $name;
            } else {
                $fields[] = '';
            }
        }

        return $fields;
    }
693898
protected function checkFields(){
        return $this->fields = is_array($this->fields) ? $this->getFields($this->fields) :  $this->getFields([$this->fields]);
    }