EntityRevisionConverter::isEditFormPage

protected EntityRevisionConverter::isEditFormPage(Route $route)

Determines if a given route is the edit-form for an entity.

Parameters

\Symfony\Component\Routing\Route $route: The route definition.

Return value

bool Returns TRUE if the route is the edit form of an entity, FALSE otherwise.

File

core/modules/content_moderation/src/ParamConverter/EntityRevisionConverter.php, line 72

Class

EntityRevisionConverter
Defines a class for making sure the edit-route loads the current draft.

Namespace

Drupal\content_moderation\ParamConverter

Code

protected function isEditFormPage(Route $route) {
  if ($default = $route->getDefault('_entity_form')) {
    // If no operation is provided, use 'default'.
    $default .= '.default';
    list($entity_type_id, $operation) = explode('.', $default);
    if (!$this->entityManager->hasDefinition($entity_type_id)) {
      return FALSE;
    }
    $entity_type = $this->entityManager->getDefinition($entity_type_id);
    return $operation == 'edit' && $entity_type && $entity_type->isRevisionable();
  }
}
doc_Drupal
2016-10-29 09:07:29
Comments
Leave a Comment

Please login to continue.