diff --git a/core/modules/field_ui/src/Form/FieldConfigEditForm.php b/core/modules/field_ui/src/Form/FieldConfigEditForm.php
index 8a3cd54..8343fff 100644
--- a/core/modules/field_ui/src/Form/FieldConfigEditForm.php
+++ b/core/modules/field_ui/src/Form/FieldConfigEditForm.php
@@ -35,18 +35,20 @@ class FieldConfigEditForm extends EntityForm {
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
- $field_storage = $this->entity->getFieldStorageDefinition();
+ /** @var \Drupal\field\Entity\FieldConfig $field */
+ $field = $this->entity;
+ $field_storage = $field->getFieldStorageDefinition();
$bundles = $this->entityManager->getBundleInfo($this->entity->getTargetEntityTypeId());
$form_title = $this->t('%field settings for %bundle', array(
- '%field' => $this->entity->getLabel(),
- '%bundle' => $bundles[$this->entity->bundle]['label'],
+ '%field' => $field->getLabel(),
+ '%bundle' => $bundles[$field->getBundle()]['label'],
));
$form['#title'] = $form_title;
if ($field_storage->isLocked()) {
$form['locked'] = array(
- '#markup' => $this->t('The field %field is locked and cannot be edited.', array('%field' => $this->entity->getLabel())),
+ '#markup' => $this->t('The field %field is locked and cannot be edited.', array('%field' => $field->getLabel())),
);
return $form;
}
@@ -55,7 +57,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['label'] = array(
'#type' => 'textfield',
'#title' => $this->t('Label'),
- '#default_value' => $this->entity->getLabel() ?: $field_storage->getName(),
+ '#default_value' => $field->getLabel() ?: $field_storage->getName(),
'#required' => TRUE,
'#weight' => -20,
);
@@ -63,7 +65,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['description'] = array(
'#type' => 'textarea',
'#title' => $this->t('Help text'),
- '#default_value' => $this->entity->getDescription(),
+ '#default_value' => $field->getDescription(),
'#rows' => 5,
'#description' => $this->t('Instructions to present to the user below this field on the editing form.
Allowed HTML tags: @tags', array('@tags' => $this->displayAllowedTags())) . '
' . $this->t('This field supports tokens.'),
'#weight' => -10,
@@ -72,18 +74,18 @@ public function form(array $form, FormStateInterface $form_state) {
$form['required'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Required field'),
- '#default_value' => $this->entity->isRequired(),
+ '#default_value' => $field->isRequired(),
'#weight' => -5,
);
// Create an arbitrary entity object (used by the 'default value' widget).
$ids = (object) array(
'entity_type' => $this->entity->getTargetEntityTypeId(),
- 'bundle' => $this->entity->bundle,
+ 'bundle' => $field->getBundle(),
'entity_id' => NULL
);
$form['#entity'] = _field_create_entity_from_ids($ids);
- $items = $form['#entity']->get($this->entity->getName());
+ $items = $form['#entity']->get($field->getName());
$item = $items->first() ?: $items->appendItem();
// Add field settings for the field type and a container for third party
@@ -125,7 +127,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
$target_entity_type = $this->entityManager->getDefinition($this->entity->getTargetEntityTypeId());
$route_parameters = [
'field_config' => $this->entity->id(),
- ] + FieldUI::getRouteBundleParameter($target_entity_type, $this->entity->bundle);
+ ] + FieldUI::getRouteBundleParameter($target_entity_type, $this->entity->getBundle());
$url = new Url('entity.field_config.' . $target_entity_type->id() . '_field_delete_form', $route_parameters);
if ($this->getRequest()->query->has('destination')) {
@@ -188,7 +190,7 @@ public function save(array $form, FormStateInterface $form_state) {
$form_state->setRedirectUrl($next_destination);
}
else {
- $form_state->setRedirectUrl(FieldUI::getOverviewRouteInfo($this->entity->getTargetEntityTypeId(), $this->entity->bundle));
+ $form_state->setRedirectUrl(FieldUI::getOverviewRouteInfo($this->entity->getTargetEntityTypeId(), $this->entity->getBundle()));
}
}