Commit 5ab08474 authored by catch's avatar catch

Issue #2071493 by tim.plunkett: Modernize field_ui().module forms.

parent 7e1dbf11
......@@ -8,7 +8,6 @@
namespace Drupal\field_ui;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Controller\ControllerInterface;
use Drupal\entity\EntityDisplayBaseInterface;
use Drupal\field\FieldInstanceInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -16,7 +15,7 @@
/**
* Field UI display overview form.
*/
class DisplayOverview extends DisplayOverviewBase implements ControllerInterface {
class DisplayOverview extends DisplayOverviewBase {
/**
* {@inheritdoc}
......@@ -24,6 +23,7 @@ class DisplayOverview extends DisplayOverviewBase implements ControllerInterface
public static function create(ContainerInterface $container) {
return new static(
$container->get('plugin.manager.entity'),
$container->get('plugin.manager.entity.field.field_type'),
$container->get('plugin.manager.field.formatter')
);
}
......@@ -46,7 +46,7 @@ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, En
$label = array(
'label' => array(
'#type' => 'select',
'#title' => t('Label display for @title', array('@title' => $instance['label'])),
'#title' => $this->t('Label display for @title', array('@title' => $instance['label'])),
'#title_display' => 'invisible',
'#options' => $this->getFieldLabelOptions(),
'#default_value' => $display_options ? $display_options['label'] : 'above',
......@@ -57,10 +57,10 @@ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, En
$field_row = array_slice($field_row, 0, $label_position, TRUE) + $label + array_slice($field_row, $label_position, count($field_row) - 1, TRUE);
// Update the (invisible) title of the 'plugin' column.
$field_row['plugin']['#title'] = t('Formatter for @title', array('@title' => $instance['label']));
$field_row['plugin']['#title'] = $this->t('Formatter for @title', array('@title' => $instance['label']));
if (!empty($field_row['plugin']['settings_edit_form'])) {
$plugin_type_info = $entity_display->getRenderer($field_id)->getPluginDefinition();
$field_row['plugin']['settings_edit_form']['label']['#markup'] = t('Format settings:') . ' <span class="plugin-name">' . $plugin_type_info['label'] . '</span>';
$field_row['plugin']['settings_edit_form']['label']['#markup'] = $this->t('Format settings:') . ' <span class="plugin-name">' . $plugin_type_info['label'] . '</span>';
}
return $field_row;
......@@ -119,7 +119,7 @@ protected function getPlugin($instance, $configuration) {
* {@inheritdoc}
*/
protected function getPluginOptions($field_type) {
return parent::getPluginOptions($field_type) + array('hidden' => '- ' . t('Hidden') . ' -');
return parent::getPluginOptions($field_type) + array('hidden' => '- ' . $this->t('Hidden') . ' -');
}
/**
......@@ -157,11 +157,11 @@ protected function saveDisplayModeSettings($display_mode_settings) {
*/
protected function getTableHeader() {
return array(
t('Field'),
t('Weight'),
t('Parent'),
t('Label'),
array('data' => t('Format'), 'colspan' => 3),
$this->t('Field'),
$this->t('Weight'),
$this->t('Parent'),
$this->t('Label'),
array('data' => $this->t('Format'), 'colspan' => 3),
);
}
......@@ -180,9 +180,9 @@ protected function getOverviewPath($mode) {
*/
protected function getFieldLabelOptions() {
return array(
'above' => t('Above'),
'inline' => t('Inline'),
'hidden' => '- ' . t('Hidden') . ' -',
'above' => $this->t('Above'),
'inline' => $this->t('Inline'),
'hidden' => '- ' . $this->t('Hidden') . ' -',
);
}
......
......@@ -9,6 +9,7 @@
use Drupal\Component\Plugin\PluginManagerBase;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\Field\FieldTypePluginManager;
use Drupal\entity\EntityDisplayBaseInterface;
use Drupal\field\FieldInstanceInterface;
use Drupal\field_ui\OverviewBase;
......@@ -38,14 +39,27 @@ abstract class DisplayOverviewBase extends OverviewBase {
*
* @param \Drupal\Core\Entity\EntityManager $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\Field\FieldTypePluginManager $field_type_manager
* The field type manager.
* @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager
* The widget or formatter plugin manager.
*/
public function __construct(EntityManager $entity_manager, PluginManagerBase $plugin_manager) {
public function __construct(EntityManager $entity_manager, FieldTypePluginManager $field_type_manager, PluginManagerBase $plugin_manager) {
parent::__construct($entity_manager);
$this->fieldTypes = $field_type_manager->getDefinitions();
$this->pluginManager = $plugin_manager;
$this->fieldTypes = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions();
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('plugin.manager.entity'),
$container->get('plugin.manager.entity.field.field_type'),
$container->get('plugin.manager.field.widget')
);
}
/**
......@@ -54,13 +68,13 @@ public function __construct(EntityManager $entity_manager, PluginManagerBase $pl
public function getRegions() {
return array(
'content' => array(
'title' => t('Content'),
'title' => $this->t('Content'),
'invisible' => TRUE,
'message' => t('No field is displayed.')
'message' => $this->t('No field is displayed.')
),
'hidden' => array(
'title' => t('Disabled'),
'message' => t('No field is hidden.')
'title' => $this->t('Disabled'),
'message' => $this->t('No field is hidden.')
),
);
}
......@@ -91,7 +105,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
);
if (empty($instances) && empty($extra_fields)) {
drupal_set_message(t('There are no fields yet added. You can add new fields on the <a href="@link">Manage fields</a> page.', array('@link' => url($this->adminPath . '/fields'))), 'warning');
drupal_set_message($this->t('There are no fields yet added. You can add new fields on the <a href="@link">Manage fields</a> page.', array('@link' => url($this->adminPath . '/fields'))), 'warning');
return $form;
}
......@@ -128,7 +142,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
if ($display_modes = $this->getDisplayModes()) {
$form['modes'] = array(
'#type' => 'details',
'#title' => t('Custom display settings'),
'#title' => $this->t('Custom display settings'),
'#collapsed' => TRUE,
);
// Collect options and default values for the 'Custom display settings'
......@@ -144,7 +158,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
}
$form['modes']['display_modes_custom'] = array(
'#type' => 'checkboxes',
'#title' => t('Use custom display settings for the following modes'),
'#title' => $this->t('Use custom display settings for the following modes'),
'#options' => $options,
'#default_value' => $default,
);
......@@ -160,7 +174,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
$form['refresh_rows'] = array('#type' => 'hidden');
$form['refresh'] = array(
'#type' => 'submit',
'#value' => t('Refresh'),
'#value' => $this->t('Refresh'),
'#op' => 'refresh_table',
'#submit' => array(array($this, 'multistepSubmit')),
'#ajax' => array(
......@@ -175,7 +189,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save'));
$form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save'));
$form['#attached']['library'][] = array('field_ui', 'drupal.field_ui');
......@@ -220,7 +234,7 @@ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, En
),
'weight' => array(
'#type' => 'textfield',
'#title' => t('Weight for @title', array('@title' => $instance['label'])),
'#title' => $this->t('Weight for @title', array('@title' => $instance['label'])),
'#title_display' => 'invisible',
'#default_value' => $display_options ? $display_options['weight'] : '0',
'#size' => 3,
......@@ -229,7 +243,7 @@ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, En
'parent_wrapper' => array(
'parent' => array(
'#type' => 'select',
'#title' => t('Label display for @title', array('@title' => $instance['label'])),
'#title' => $this->t('Label display for @title', array('@title' => $instance['label'])),
'#title_display' => 'invisible',
'#options' => drupal_map_assoc(array_keys($this->getRegions())),
'#empty_value' => '',
......@@ -248,7 +262,7 @@ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, En
$field_row['plugin'] = array(
'type' => array(
'#type' => 'select',
'#title' => t('Plugin for @title', array('@title' => $instance['label'])),
'#title' => $this->t('Plugin for @title', array('@title' => $instance['label'])),
'#title_display' => 'invisible',
'#options' => $this->getPluginOptions($field['type']),
'#default_value' => $display_options ? $display_options['type'] : 'hidden',
......@@ -298,7 +312,7 @@ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, En
'#attributes' => array('class' => array('field-plugin-settings-edit-form')),
'#parents' => array('fields', $field_id, 'settings_edit_form'),
'label' => array(
'#markup' => t('Plugin settings'),
'#markup' => $this->t('Plugin settings'),
),
'settings' => $settings_form,
'actions' => array(
......@@ -306,13 +320,13 @@ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, En
'save_settings' => $base_button + array(
'#type' => 'submit',
'#name' => $field_id . '_plugin_settings_update',
'#value' => t('Update'),
'#value' => $this->t('Update'),
'#op' => 'update',
),
'cancel_settings' => $base_button + array(
'#type' => 'submit',
'#name' => $field_id . '_plugin_settings_cancel',
'#value' => t('Cancel'),
'#value' => $this->t('Cancel'),
'#op' => 'cancel',
// Do not check errors for the 'Cancel' button, but make sure we
// get the value of the 'plugin type' select.
......@@ -345,7 +359,7 @@ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, En
'#type' => 'image_button',
'#name' => $field_id . '_settings_edit',
'#src' => 'core/misc/configure-dark.png',
'#attributes' => array('class' => array('field-plugin-settings-edit'), 'alt' => t('Edit')),
'#attributes' => array('class' => array('field-plugin-settings-edit'), 'alt' => $this->t('Edit')),
'#op' => 'edit',
// Do not check errors for the 'Edit' button, but make sure we get
// the value of the 'plugin type' select.
......@@ -386,7 +400,7 @@ protected function buildExtraFieldRow($field_id, $extra_field, $entity_display)
),
'weight' => array(
'#type' => 'textfield',
'#title' => t('Weight for @title', array('@title' => $extra_field['label'])),
'#title' => $this->t('Weight for @title', array('@title' => $extra_field['label'])),
'#title_display' => 'invisible',
'#default_value' => $display_options ? $display_options['weight'] : 0,
'#size' => 3,
......@@ -395,7 +409,7 @@ protected function buildExtraFieldRow($field_id, $extra_field, $entity_display)
'parent_wrapper' => array(
'parent' => array(
'#type' => 'select',
'#title' => t('Parents for @title', array('@title' => $extra_field['label'])),
'#title' => $this->t('Parents for @title', array('@title' => $extra_field['label'])),
'#title_display' => 'invisible',
'#options' => drupal_map_assoc(array_keys($this->getRegions())),
'#empty_value' => '',
......@@ -411,7 +425,7 @@ protected function buildExtraFieldRow($field_id, $extra_field, $entity_display)
'plugin' => array(
'type' => array(
'#type' => 'select',
'#title' => t('Visibility for @title', array('@title' => $extra_field['label'])),
'#title' => $this->t('Visibility for @title', array('@title' => $extra_field['label'])),
'#title_display' => 'invisible',
'#options' => $this->getExtraFieldVisibilityOptions(),
'#default_value' => $display_options ? 'visible' : 'hidden',
......@@ -510,7 +524,7 @@ public function submitForm(array &$form, array &$form_state) {
$display_mode_label = $display_modes[$mode]['label'];
$path = $this->getOverviewPath($mode);
drupal_set_message(t('The %display_mode mode now uses custom display settings. You might want to <a href="@url">configure them</a>.', array('%display_mode' => $display_mode_label, '@url' => url($path))));
drupal_set_message($this->t('The %display_mode mode now uses custom display settings. You might want to <a href="@url">configure them</a>.', array('%display_mode' => $display_mode_label, '@url' => url($path))));
}
$display_mode_bundle_settings[$mode]['status'] = !empty($value);
}
......@@ -519,7 +533,7 @@ public function submitForm(array &$form, array &$form_state) {
$this->saveDisplayModeSettings($display_mode_bundle_settings);
}
drupal_set_message(t('Your settings have been saved.'));
drupal_set_message($this->t('Your settings have been saved.'));
}
/**
......@@ -705,8 +719,8 @@ public function getRowRegion($row) {
*/
protected function getExtraFieldVisibilityOptions() {
return array(
'visible' => t('Visible'),
'hidden' => '- ' . t('Hidden') . ' -',
'visible' => $this->t('Visible'),
'hidden' => '- ' . $this->t('Hidden') . ' -',
);
}
......
......@@ -66,10 +66,10 @@ public static function create(ContainerInterface $container) {
public function getRegions() {
return array(
'content' => array(
'title' => t('Content'),
'title' => $this->t('Content'),
'invisible' => TRUE,
// @todo Bring back this message in https://drupal.org/node/1963340.
//'message' => t('No fields are present yet.'),
//'message' => $this->t('No fields are present yet.'),
),
);
}
......@@ -104,10 +104,10 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
'#type' => 'field_ui_table',
'#tree' => TRUE,
'#header' => array(
t('Label'),
t('Machine name'),
t('Field type'),
t('Operations'),
$this->t('Label'),
$this->t('Machine name'),
$this->t('Field type'),
$this->t('Operations'),
),
'#regions' => $this->getRegions(),
'#attributes' => array(
......@@ -134,25 +134,25 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
'#type' => 'link',
'#title' => $field_types[$field['type']]['label'],
'#href' => $admin_field_path . '/field',
'#options' => array('attributes' => array('title' => t('Edit field settings.'))),
'#options' => array('attributes' => array('title' => $this->t('Edit field settings.'))),
),
);
$links = array();
$links['edit'] = array(
'title' => t('Edit'),
'title' => $this->t('Edit'),
'href' => $admin_field_path,
'attributes' => array('title' => t('Edit instance settings.')),
'attributes' => array('title' => $this->t('Edit instance settings.')),
);
$links['field-settings'] = array(
'title' => t('Field settings'),
'title' => $this->t('Field settings'),
'href' => $admin_field_path . '/field',
'attributes' => array('title' => t('Edit field settings.')),
'attributes' => array('title' => $this->t('Edit field settings.')),
);
$links['delete'] = array(
'title' => t('Delete'),
'title' => $this->t('Delete'),
'href' => "$admin_field_path/delete",
'attributes' => array('title' => t('Delete instance.')),
'attributes' => array('title' => $this->t('Delete instance.')),
);
// Allow altering the operations on this entity listing.
$this->moduleHandler->alter('entity_operation', $links, $instance);
......@@ -162,7 +162,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
);
if (!empty($field['locked'])) {
$table[$name]['operations'] = array('#markup' => t('Locked'));
$table[$name]['operations'] = array('#markup' => $this->t('Locked'));
$table[$name]['#attributes']['class'][] = 'menu-disabled';
}
}
......@@ -184,22 +184,22 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
'#attributes' => array('class' => array('add-new')),
'label' => array(
'#type' => 'textfield',
'#title' => t('New field label'),
'#title' => $this->t('New field label'),
'#title_display' => 'invisible',
'#size' => 15,
'#description' => t('Label'),
'#prefix' => '<div class="label-input"><div class="add-new-placeholder">' . t('Add new field') .'</div>',
'#description' => $this->t('Label'),
'#prefix' => '<div class="label-input"><div class="add-new-placeholder">' . $this->t('Add new field') .'</div>',
'#suffix' => '</div>',
),
'field_name' => array(
'#type' => 'machine_name',
'#title' => t('New field name'),
'#title' => $this->t('New field name'),
'#title_display' => 'invisible',
// This field should stay LTR even for RTL languages.
'#field_prefix' => '<span dir="ltr">' . $field_prefix,
'#field_suffix' => '</span>&lrm;',
'#size' => 15,
'#description' => t('A unique machine-readable name containing letters, numbers, and underscores.'),
'#description' => $this->t('A unique machine-readable name containing letters, numbers, and underscores.'),
// Calculate characters depending on the length of the field prefix
// setting. Maximum length is 32.
'#maxlength' => Field::ID_MAX_LENGTH - strlen($field_prefix),
......@@ -214,11 +214,11 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
),
'type' => array(
'#type' => 'select',
'#title' => t('Type of new field'),
'#title' => $this->t('Type of new field'),
'#title_display' => 'invisible',
'#options' => $field_type_options,
'#empty_option' => t('- Select a field type -'),
'#description' => t('Type of data to store.'),
'#empty_option' => $this->t('- Select a field type -'),
'#description' => $this->t('Type of data to store.'),
'#attributes' => array('class' => array('field-type-select')),
'#cell_attributes' => array('colspan' => 2),
'#prefix' => '<div class="add-new-placeholder">&nbsp;</div>',
......@@ -238,7 +238,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
// Build list of options.
$existing_field_options = array();
foreach ($existing_fields as $field_name => $info) {
$text = t('@type: @field (@label)', array(
$text = $this->t('@type: @field (@label)', array(
'@type' => $info['type_label'],
'@label' => $info['label'],
'@field' => $info['field'],
......@@ -253,21 +253,21 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
'#region_callback' => array($this, 'getRowRegion'),
'label' => array(
'#type' => 'textfield',
'#title' => t('Existing field label'),
'#title' => $this->t('Existing field label'),
'#title_display' => 'invisible',
'#size' => 15,
'#description' => t('Label'),
'#description' => $this->t('Label'),
'#attributes' => array('class' => array('label-textfield')),
'#prefix' => '<div class="label-input"><div class="add-new-placeholder">' . t('Re-use existing field') .'</div>',
'#prefix' => '<div class="label-input"><div class="add-new-placeholder">' . $this->t('Re-use existing field') .'</div>',
'#suffix' => '</div>',
),
'field_name' => array(
'#type' => 'select',
'#title' => t('Existing field to share'),
'#title' => $this->t('Existing field to share'),
'#title_display' => 'invisible',
'#options' => $existing_field_options,
'#empty_option' => t('- Select an existing field -'),
'#description' => t('Field to share'),
'#empty_option' => $this->t('- Select an existing field -'),
'#description' => $this->t('Field to share'),
'#attributes' => array('class' => array('field-select')),
'#cell_attributes' => array('colspan' => 3),
'#prefix' => '<div class="add-new-placeholder">&nbsp;</div>',
......@@ -285,7 +285,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
$form['fields'] = $table;
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save'));
$form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save'));
return $form;
}
......@@ -315,12 +315,12 @@ protected function validateAddNew(array $form, array &$form_state) {
if (array_filter(array($field['label'], $field['field_name'], $field['type']))) {
// Missing label.
if (!$field['label']) {
form_set_error('fields][_add_new_field][label', t('Add new field: you need to provide a label.'));
form_set_error('fields][_add_new_field][label', $this->t('Add new field: you need to provide a label.'));
}
// Missing field name.
if (!$field['field_name']) {
form_set_error('fields][_add_new_field][field_name', t('Add new field: you need to provide a field name.'));
form_set_error('fields][_add_new_field][field_name', $this->t('Add new field: you need to provide a field name.'));
}
// Field name validation.
else {
......@@ -333,7 +333,7 @@ protected function validateAddNew(array $form, array &$form_state) {
// Missing field type.
if (!$field['type']) {
form_set_error('fields][_add_new_field][type', t('Add new field: you need to select a field type.'));
form_set_error('fields][_add_new_field][type', $this->t('Add new field: you need to select a field type.'));
}
}
}
......@@ -359,12 +359,12 @@ protected function validateAddExisting(array $form, array &$form_state) {
if (array_filter(array($field['label'], $field['field_name']))) {
// Missing label.
if (!$field['label']) {
form_set_error('fields][_add_existing_field][label', t('Re-use existing field: you need to provide a label.'));
form_set_error('fields][_add_existing_field][label', $this->t('Re-use existing field: you need to provide a label.'));
}
// Missing existing field name.
if (!$field['field_name']) {
form_set_error('fields][_add_existing_field][field_name', t('Re-use existing field: you need to select a field.'));
form_set_error('fields][_add_existing_field][field_name', $this->t('Re-use existing field: you need to select a field.'));
}
}
}
......@@ -422,7 +422,7 @@ public function submitForm(array &$form, array &$form_state) {
$form_state['fields_added']['_add_new_field'] = $field['field_name'];
}
catch (\Exception $e) {
drupal_set_message(t('There was a problem creating field %label: !message', array('%label' => $instance['label'], '!message' => $e->getMessage())), 'error');
drupal_set_message($this->t('There was a problem creating field %label: !message', array('%label' => $instance['label'], '!message' => $e->getMessage())), 'error');
}
}
......@@ -431,7 +431,7 @@ public function submitForm(array &$form, array &$form_state) {
$values = $form_values['_add_existing_field'];
$field = field_info_field($values['field_name']);
if (!empty($field['locked'])) {
drupal_set_message(t('The field %label cannot be added because it is locked.', array('%label' => $values['label'])), 'error');
drupal_set_message($this->t('The field %label cannot be added because it is locked.', array('%label' => $values['label'])), 'error');
}
else {
$instance = array(
......@@ -464,7 +464,7 @@ public function submitForm(array &$form, array &$form_state) {
$form_state['fields_added']['_add_existing_field'] = $instance['field_name'];
}
catch (\Exception $e) {
drupal_set_message(t('There was a problem creating field instance %label: @message.', array('%label' => $instance['label'], '@message' => $e->getMessage())), 'error');
drupal_set_message($this->t('There was a problem creating field instance %label: @message.', array('%label' => $instance['label'], '@message' => $e->getMessage())), 'error');
}
}
}
......@@ -479,7 +479,7 @@ public function submitForm(array &$form, array &$form_state) {
$form_state['redirect'] = array($options['path'], $options);
}
else {
drupal_set_message(t('Your settings have been saved.'));
drupal_set_message($this->t('Your settings have been saved.'));
}
}
......
......@@ -46,14 +46,14 @@ public static function create(ContainerInterface $container) {
* {@inheritdoc}
*/
public function getQuestion() {
return t('Are you sure you want to delete the field %field?', array('%field' => $this->entity->label()));
return $this->t('Are you sure you want to delete the field %field?', array('%field' => $this->entity->label()));
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return t('Delete');
return $this->t('Delete');
}
/**
......@@ -73,10 +73,10 @@ public function submit(array $form, array &$form_state) {
if ($field && !$field['locked']) {
$this->entity->delete();
drupal_set_message(t('The field %field has been deleted from the %type content type.', array('%field' => $this->entity->label(), '%type' => $bundle_label)));
drupal_set_message($this->t('The field %field has been deleted from the %type content type.', array('%field' => $this->entity->label(), '%type' => $bundle_label)));
}
else {
drupal_set_message(t('There was a problem removing the %field from the %type content type.', array('%field' => $this->entity->label(), '%type' => $bundle_label)), 'error');
drupal_set_message($this->t('There was a problem removing the %field from the %type content type.', array('%field' => $this->entity->label(), '%type' => $bundle_label)), 'error');
}
$admin_path = $this->entityManager->getAdminPath($this->entity->entity_type, $this->entity->bundle);
......
......@@ -7,19 +7,20 @@
namespace Drupal\field_ui\Form;
use Drupal\Core\Controller\ControllerInterface;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormInterface;
use Drupal\Core\Entity\EntityNG;
use Drupal\Core\Form\FormBase;
use Drupal\Core\TypedData\TypedDataManager;
use Drupal\field\FieldInfo;
use Drupal\field\FieldInstanceInterface;
use Drupal\field\Field;
use Drupal\field_ui\FieldUI;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a form for the field settings edit page.
*/
class FieldEditForm implements FormInterface, ControllerInterface {
class FieldEditForm extends FormBase {
/**
* The field instance being edited.
......@@ -35,6 +36,20 @@ class FieldEditForm implements FormInterface, ControllerInterface {
*/
protected $entityManager;
/**
* The field info service.
*
* @var \Drupal\field\FieldInfo
*/
protected $fieldInfo;
/**
* The typed data manager.
*