diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php index d4c392c..dce6ccb 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php @@ -1,5 +1,4 @@ moduleHandler = $module_handler; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('plugin.manager.entity'), + $container->get('module_handler') + ); + } + + /** * The field type manager. * * @var \Drupal\Core\Entity\Field\FieldTypePluginManager @@ -142,6 +172,8 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL, 'href' => "$admin_field_path/delete", 'attributes' => array('title' => t('Delete instance.')), ); + // Allow altering the operations on this entity listing. + $this->moduleHandler->alter('entity_operation', $links, $instance); $table[$name]['operations']['data'] = array( '#type' => 'operations', '#links' => $links, @@ -174,7 +206,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL, '#title_display' => 'invisible', '#size' => 15, '#description' => t('Label'), - '#prefix' => '
' . t('Add new field') .'
', + '#prefix' => '
' . t('Add new field') . '
', '#suffix' => '
', ), 'field_name' => array( @@ -244,7 +276,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL, '#size' => 15, '#description' => t('Label'), '#attributes' => array('class' => array('label-textfield')), - '#prefix' => '
' . t('Re-use existing field') .'
', + '#prefix' => '
' . t('Re-use existing field') . '
', '#suffix' => '
', ), 'field_name' => array( @@ -401,14 +433,17 @@ public function submitForm(array &$form, array &$form_state) { // Always show the field settings step, as the cardinality needs to be // configured for new fields. - $destinations[] = $this->adminPath. '/fields/' . $new_instance->id() . '/field'; + $destinations[] = $this->adminPath . '/fields/' . $new_instance->id() . '/field'; $destinations[] = $this->adminPath . '/fields/' . $new_instance->id(); // Store new field information for any additional submit handlers. $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(t('There was a problem creating field %label: !message', array( + '%label' => $instance['label'], + '!message' => $e->getMessage() + )), 'error'); } } @@ -450,7 +485,10 @@ 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(t('There was a problem creating field instance %label: @message.', array( + '%label' => $instance['label'], + '@message' => $e->getMessage() + )), 'error'); } } } @@ -494,7 +532,8 @@ protected function getExistingFieldOptions() { if (empty($field['locked']) && !field_info_instance($this->entity_type, $field['field_name'], $this->bundle) && (empty($field['entity_types']) || in_array($this->entity_type, $field['entity_types'])) - && empty($field_types[$field['type']]['no_ui'])) { + && empty($field_types[$field['type']]['no_ui']) + ) { $info[$instance['field_name']] = array( 'type' => $field['type'], 'type_label' => $field_types[$field['type']]['label'],