You are here

class ManageDisplayRouteEnhancer in Manage display 8

Enhances an entity form route with the appropriate controller.

Hierarchy

Expanded class hierarchy of ManageDisplayRouteEnhancer

1 string reference to 'ManageDisplayRouteEnhancer'
manage_display_fix_title.services.yml in modules/manage_display_fix_title/manage_display_fix_title.services.yml
modules/manage_display_fix_title/manage_display_fix_title.services.yml
1 service uses ManageDisplayRouteEnhancer
route_enhancer.manage_display in modules/manage_display_fix_title/manage_display_fix_title.services.yml
Drupal\manage_display_fix_title\Entity\ManageDisplayRouteEnhancer

File

modules/manage_display_fix_title/src/Entity/ManageDisplayRouteEnhancer.php, line 11

Namespace

Drupal\manage_display_fix_title\Entity
View source
class ManageDisplayRouteEnhancer implements EnhancerInterface {
  const CONTROLLER_REPLACE = [
    '\\Drupal\\Core\\Entity\\Controller\\EntityViewController::view' => '\\Drupal\\manage_display_fix_title\\Controller\\ManageDisplayEntityViewController::view',
    '\\Drupal\\node\\Controller\\NodeViewController::view' => '\\Drupal\\manage_display_fix_title\\Controller\\ManageDisplayNodeViewController::view',
  ];

  /**
   * {@inheritdoc}
   */
  public function enhance(array $defaults, Request $request) {
    if (empty(self::CONTROLLER_REPLACE[$defaults['_controller']])) {
      return $defaults;
    }
    $defaults['_controller'] = self::CONTROLLER_REPLACE[$defaults['_controller']];
    return $defaults;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ManageDisplayRouteEnhancer::CONTROLLER_REPLACE constant
ManageDisplayRouteEnhancer::enhance public function Update the defaults based on its own data and the request.