You are here

class ContactRouteProvider in Contact Storage 8

Provides routes for contact messages and contact forms.

Hierarchy

Expanded class hierarchy of ContactRouteProvider

File

src/ContactRouteProvider.php, line 12

Namespace

Drupal\contact_storage
View source
class ContactRouteProvider extends DefaultHtmlRouteProvider {

  /**
   * {@inheritdoc}
   */
  public function getRoutes(EntityTypeInterface $entity_type) {
    $route_collection = parent::getRoutes($entity_type);
    if ($entity_type
      ->hasLinkTemplate('collection')) {
      $route = (new Route($entity_type
        ->getLinkTemplate('collection')))
        ->addDefaults([
        '_entity_list' => 'contact_message',
        '_title' => 'Contact messages',
      ])
        ->addRequirements([
        '_permission' => 'administer contact forms',
      ]);
      $route_collection
        ->add('entity.' . $entity_type
        ->id() . '.collection', $route);
    }
    if ($entity_type
      ->hasLinkTemplate('clone-form')) {
      $route = (new Route($entity_type
        ->getLinkTemplate('clone-form')))
        ->addDefaults([
        '_entity_form' => 'contact_form.clone',
        '_title' => 'Clone form',
      ])
        ->addRequirements([
        '_entity_access' => 'contact_form.clone',
      ]);
      $route_collection
        ->add('entity.' . $entity_type
        ->id() . '.clone_form', $route);
    }
    return $route_collection;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContactRouteProvider::getRoutes public function Provides routes for entities. Overrides DefaultHtmlRouteProvider::getRoutes
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::getAddFormRoute protected function Gets the add-form route. 2
DefaultHtmlRouteProvider::getAddPageRoute protected function Gets the add page route. 2
DefaultHtmlRouteProvider::getCanonicalRoute protected function Gets the canonical route. 3
DefaultHtmlRouteProvider::getCollectionRoute protected function Gets the collection route. 2
DefaultHtmlRouteProvider::getDeleteFormRoute protected function Gets the delete-form route. 1
DefaultHtmlRouteProvider::getDeleteMultipleFormRoute protected function Returns the delete multiple form route. 1
DefaultHtmlRouteProvider::getEditFormRoute protected function Gets the edit-form route. 1
DefaultHtmlRouteProvider::getEntityTypeIdKeyType protected function Gets the type of the ID key for a given entity type. 1
DefaultHtmlRouteProvider::__construct public function Constructs a new DefaultHtmlRouteProvider. 1