function FieldConfigEditForm::getTypedData

Same name and namespace in other branches
  1. 10 core/modules/field_ui/src/Form/FieldConfigEditForm.php \Drupal\field_ui\Form\FieldConfigEditForm::getTypedData()

Gets typed data object for the field.

Parameters

\Drupal\field\FieldConfigInterface $field_config: The field configuration.

\Drupal\Core\Entity\FieldableEntityInterface $parent: The parent entity that the field is attached to.

Return value

\Drupal\Core\TypedData\TypedDataInterface

3 calls to FieldConfigEditForm::getTypedData()
FieldConfigEditForm::form in core/modules/field_ui/src/Form/FieldConfigEditForm.php
Gets the actual form array to be built.
FieldConfigEditForm::submitForm in core/modules/field_ui/src/Form/FieldConfigEditForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form stateā€¦
FieldConfigEditForm::validateForm in core/modules/field_ui/src/Form/FieldConfigEditForm.php
Form validation handler.

File

core/modules/field_ui/src/Form/FieldConfigEditForm.php, line 454

Class

FieldConfigEditForm
Provides a form for the field settings form.

Namespace

Drupal\field_ui\Form

Code

private function getTypedData(FieldConfigInterface $field_config, FieldableEntityInterface $parent) : TypedDataInterface {
    // Make sure that typed data manager is re-generating the instance. This
    // important because we want the returned instance to match the current
    // state, which could be different from what has been stored in config.
    $this->typedDataManager
        ->clearCachedDefinitions();
    $entity_adapter = EntityAdapter::createFromEntity($parent);
    return $this->typedDataManager
        ->create($field_config, $field_config->getDefaultValue($parent), $field_config->getName(), $entity_adapter);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.