You are here

class GroupRoleRouteProvider in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Routing/GroupRoleRouteProvider.php \Drupal\group\Entity\Routing\GroupRoleRouteProvider

Provides routes for group roles.

Hierarchy

Expanded class hierarchy of GroupRoleRouteProvider

File

src/Entity/Routing/GroupRoleRouteProvider.php, line 11

Namespace

Drupal\group\Entity\Routing
View source
class GroupRoleRouteProvider extends DefaultHtmlRouteProvider {

  /**
   * {@inheritdoc}
   */
  protected function getAddFormRoute(EntityTypeInterface $entity_type) {
    if ($route = parent::getAddFormRoute($entity_type)) {
      $route
        ->setOption('parameters', [
        'group_type' => [
          'type' => 'entity:group_type',
        ],
      ]);
      return $route;
    }
  }

  /**
   * {@inheritdoc}
   */
  protected function getEditFormRoute(EntityTypeInterface $entity_type) {
    if ($route = parent::getEditFormRoute($entity_type)) {

      // @todo Remove title part when https://www.drupal.org/node/2827739 lands.
      $route
        ->setDefault('_title_callback', '\\Drupal\\group\\Entity\\Controller\\GroupRoleController::editTitle');
      $route
        ->setOption('parameters', [
        'group_type' => [
          'type' => 'entity:group_type',
        ],
      ]);
      return $route;
    }
  }

  /**
   * {@inheritdoc}
   */
  protected function getDeleteFormRoute(EntityTypeInterface $entity_type) {
    if ($route = parent::getDeleteFormRoute($entity_type)) {

      // @todo Remove title part when https://www.drupal.org/node/2827739 lands.
      $route
        ->setDefault('_title_callback', '\\Drupal\\group\\Entity\\Controller\\GroupRoleController::deleteTitle');
      $route
        ->setOption('parameters', [
        'group_type' => [
          'type' => 'entity:group_type',
        ],
      ]);
      return $route;
    }
  }

  /**
   * {@inheritdoc}
   */
  protected function getCollectionRoute(EntityTypeInterface $entity_type) {
    if ($route = parent::getCollectionRoute($entity_type)) {

      // @todo Remove title part when https://www.drupal.org/node/2767025 lands.
      $route
        ->setDefault('_title', 'Group roles');
      $route
        ->setDefault('_title_arguments', []);
      $route
        ->setOption('parameters', [
        'group_type' => [
          'type' => 'entity:group_type',
        ],
      ]);
      return $route;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DefaultHtmlRouteProvider::$entityFieldManager protected property The entity field manager.
DefaultHtmlRouteProvider::$entityTypeManager protected property The entity type manager.
DefaultHtmlRouteProvider::createInstance public static function Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface::createInstance 1
DefaultHtmlRouteProvider::getAddPageRoute protected function Gets the add page route. 2
DefaultHtmlRouteProvider::getCanonicalRoute protected function Gets the canonical route. 3
DefaultHtmlRouteProvider::getDeleteMultipleFormRoute protected function Returns the delete multiple form route. 1
DefaultHtmlRouteProvider::getEntityTypeIdKeyType protected function Gets the type of the ID key for a given entity type. 1
DefaultHtmlRouteProvider::getRoutes public function Provides routes for entities. Overrides EntityRouteProviderInterface::getRoutes 1
DefaultHtmlRouteProvider::__construct public function Constructs a new DefaultHtmlRouteProvider. 1
GroupRoleRouteProvider::getAddFormRoute protected function Gets the add-form route. Overrides DefaultHtmlRouteProvider::getAddFormRoute
GroupRoleRouteProvider::getCollectionRoute protected function Gets the collection route. Overrides DefaultHtmlRouteProvider::getCollectionRoute
GroupRoleRouteProvider::getDeleteFormRoute protected function Gets the delete-form route. Overrides DefaultHtmlRouteProvider::getDeleteFormRoute
GroupRoleRouteProvider::getEditFormRoute protected function Gets the edit-form route. Overrides DefaultHtmlRouteProvider::getEditFormRoute