class UserFormModesSubscriber in Form mode manager 8
Subscriber for form_mode_manager routes.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\form_mode_manager\Routing\EventSubscriber\FormModesSubscriber uses StringTranslationTrait
- class \Drupal\form_mode_manager\Routing\EventSubscriber\UserFormModesSubscriber
- class \Drupal\form_mode_manager\Routing\EventSubscriber\FormModesSubscriber uses StringTranslationTrait
Expanded class hierarchy of UserFormModesSubscriber
1 string reference to 'UserFormModesSubscriber'
1 service uses UserFormModesSubscriber
File
- src/
Routing/ EventSubscriber/ UserFormModesSubscriber.php, line 11
Namespace
Drupal\form_mode_manager\Routing\EventSubscriberView source
class UserFormModesSubscriber extends FormModesSubscriber {
/**
* {@inheritdoc}
*/
const FORM_MODE_DEFAULT_CONTROLLER = '\\Drupal\\form_mode_manager\\Controller\\UserFormModeController';
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
$form_modes_definitions = $this->formModeManager
->getAllFormModesDefinitions();
$entity_type_id = 'user';
if (isset($form_modes_definitions[$entity_type_id])) {
$form_modes = $form_modes_definitions[$entity_type_id];
$entity_type = $this->entityTypeManager
->getDefinition($entity_type_id);
$this
->addFormModesRoutes($collection, $entity_type, $form_modes);
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
// Ensure fire after FormModesSubscriber alters.
$events[RoutingEvents::ALTER] = [
'onAlterRoutes',
10,
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FormModesSubscriber:: |
protected | property | The entity display repository. | |
FormModesSubscriber:: |
protected | property | The Routes Manager Plugin. | |
FormModesSubscriber:: |
protected | property | The entity type manager service. | |
FormModesSubscriber:: |
protected | property | The entity display repository. | |
FormModesSubscriber:: |
protected | function | Generate all operations routes for entities. | |
FormModesSubscriber:: |
public | function | Generate route to Form Mode Manager `add-list` route. | |
FormModesSubscriber:: |
public | function | Get the Form Mode Manager route for given operation. | |
FormModesSubscriber:: |
protected | function | Get defaults parameters nedeed to build Form Mode Manager routes. | |
FormModesSubscriber:: |
protected | function | Get options parameters nedeed to build Form Mode Manager routes. | |
FormModesSubscriber:: |
protected | function | Get options requirements nedeed to build Form Mode Manager routes. | |
FormModesSubscriber:: |
public static | function | Evaluate if current context is edit. | |
FormModesSubscriber:: |
constant | The Regex pattern to contextualize process by route path. | ||
FormModesSubscriber:: |
public | function | Set one add_page route per form_mode for compatible entities. | |
FormModesSubscriber:: |
public | function | Create a route per form_mode for given operation form. | |
FormModesSubscriber:: |
private | function | Set Form Mode Manager routes based on parent entity routes. | |
FormModesSubscriber:: |
public | function | Set a specific callback for Edit context of User entity. | |
FormModesSubscriber:: |
public | function | Constructs a new RouteSubscriber object. | |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UserFormModesSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides FormModesSubscriber:: |
|
UserFormModesSubscriber:: |
constant |
The Regex pattern to contextualize process by route path. Overrides FormModesSubscriber:: |
||
UserFormModesSubscriber:: |
public static | function |
Returns an array of event names this subscriber wants to listen to. Overrides RouteSubscriberBase:: |