Commit faaaaae6 authored by alexpott's avatar alexpott

Issue #2045043 by bechtold, vijaycs85, YesCT, Gábor Hojtsy: Fixed Field...

Issue #2045043 by bechtold, vijaycs85, YesCT, Gábor Hojtsy: Fixed Field listings operations cannot be altered.
parent 1d2de462
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\Field\FieldTypePluginManager; use Drupal\Core\Entity\Field\FieldTypePluginManager;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\field_ui\OverviewBase; use Drupal\field_ui\OverviewBase;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\field\Plugin\Core\Entity\Field; use Drupal\field\Plugin\Core\Entity\Field;
...@@ -25,6 +26,13 @@ class FieldOverview extends OverviewBase { ...@@ -25,6 +26,13 @@ class FieldOverview extends OverviewBase {
*/ */
protected $fieldTypeManager; protected $fieldTypeManager;
/**
* The module handler service.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/** /**
* Constructs a new FieldOverview. * Constructs a new FieldOverview.
* *
...@@ -32,10 +40,13 @@ class FieldOverview extends OverviewBase { ...@@ -32,10 +40,13 @@ class FieldOverview extends OverviewBase {
* The entity manager. * The entity manager.
* @param \Drupal\Core\Entity\Field\FieldTypePluginManager $field_type_manager * @param \Drupal\Core\Entity\Field\FieldTypePluginManager $field_type_manager
* The field type manager * The field type manager
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler to invoke hooks on.
*/ */
public function __construct(EntityManager $entity_manager, FieldTypePluginManager $field_type_manager) { public function __construct(EntityManager $entity_manager, FieldTypePluginManager $field_type_manager, ModuleHandlerInterface $module_handler) {
$this->entityManager = $entity_manager; parent::__construct($entity_manager);
$this->fieldTypeManager = $field_type_manager; $this->fieldTypeManager = $field_type_manager;
$this->moduleHandler = $module_handler;
} }
/** /**
...@@ -44,7 +55,8 @@ public function __construct(EntityManager $entity_manager, FieldTypePluginManage ...@@ -44,7 +55,8 @@ public function __construct(EntityManager $entity_manager, FieldTypePluginManage
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('plugin.manager.entity'), $container->get('plugin.manager.entity'),
$container->get('plugin.manager.entity.field.field_type') $container->get('plugin.manager.entity.field.field_type'),
$container->get('module_handler')
); );
} }
...@@ -142,6 +154,8 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL, ...@@ -142,6 +154,8 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL,
'href' => "$admin_field_path/delete", 'href' => "$admin_field_path/delete",
'attributes' => array('title' => t('Delete instance.')), '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( $table[$name]['operations']['data'] = array(
'#type' => 'operations', '#type' => 'operations',
'#links' => $links, '#links' => $links,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment