Skip to content
Snippets Groups Projects
Commit 78f93fae authored by Alex Pott's avatar Alex Pott
Browse files

Issue #1810320 by alarcombe: Remove...

Issue #1810320 by alarcombe: Remove EntityTranslationControllerInterface::getAccess() once have entity access.
parent 08f15f24
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -15,13 +15,6 @@ ...@@ -15,13 +15,6 @@
*/ */
class CustomBlockTranslationController extends ContentTranslationControllerNG { class CustomBlockTranslationController extends ContentTranslationControllerNG {
/**
* Overrides ContentTranslationController::getAccess().
*/
public function getAccess(EntityInterface $entity, $op) {
return user_access('administer blocks');
}
/** /**
* Overrides ContentTranslationController::entityFormAlter(). * Overrides ContentTranslationController::entityFormAlter().
*/ */
......
...@@ -86,7 +86,7 @@ function content_translation_overview(EntityInterface $entity) { ...@@ -86,7 +86,7 @@ function content_translation_overview(EntityInterface $entity) {
// If the user is allowed to edit the entity we point the edit link to // If the user is allowed to edit the entity we point the edit link to
// the entity form, otherwise if we are not dealing with the original // the entity form, otherwise if we are not dealing with the original
// language we point the link to the translation form. // language we point the link to the translation form.
if ($edit_path && $controller->getAccess($entity, 'update')) { if ($edit_path && $entity->access('update')) {
$links['edit'] = isset($edit_links->links[$langcode]['href']) ? $edit_links->links[$langcode] : array('href' => $edit_path, 'language' => $language); $links['edit'] = isset($edit_links->links[$langcode]['href']) ? $edit_links->links[$langcode] : array('href' => $edit_path, 'language' => $language);
} }
elseif (!$is_original && $controller->getTranslationAccess($entity, 'update')) { elseif (!$is_original && $controller->getTranslationAccess($entity, 'update')) {
...@@ -201,7 +201,7 @@ function content_translation_add_page(EntityInterface $entity, Language $source ...@@ -201,7 +201,7 @@ function content_translation_add_page(EntityInterface $entity, Language $source
$form_state['content_translation']['source'] = $source; $form_state['content_translation']['source'] = $source;
$form_state['content_translation']['target'] = $target; $form_state['content_translation']['target'] = $target;
$controller = content_translation_controller($entity->entityType()); $controller = content_translation_controller($entity->entityType());
$form_state['content_translation']['translation_form'] = !$controller->getAccess($entity, 'update'); $form_state['content_translation']['translation_form'] = !$entity->access('update');
return Drupal::entityManager()->getForm($entity, $operation, $form_state); return Drupal::entityManager()->getForm($entity, $operation, $form_state);
} }
......
...@@ -90,13 +90,6 @@ public function getViewPath(EntityInterface $entity) { ...@@ -90,13 +90,6 @@ public function getViewPath(EntityInterface $entity) {
return isset($this->entityInfo['menu_view_path']) ? $this->getPathInstance($this->entityInfo['menu_view_path'], $entity->id()) : FALSE; return isset($this->entityInfo['menu_view_path']) ? $this->getPathInstance($this->entityInfo['menu_view_path'], $entity->id()) : FALSE;
} }
/**
* Implements ContentTranslationControllerInterface::getAccess().
*/
public function getAccess(EntityInterface $entity, $op) {
return TRUE;
}
/** /**
* Implements ContentTranslationControllerInterface::getTranslationAccess(). * Implements ContentTranslationControllerInterface::getTranslationAccess().
*/ */
......
...@@ -111,24 +111,6 @@ public function getEditPath(EntityInterface $entity); ...@@ -111,24 +111,6 @@ public function getEditPath(EntityInterface $entity);
*/ */
public function getViewPath(EntityInterface $entity); public function getViewPath(EntityInterface $entity);
/**
* Checks if the user can perform the given operation on the wrapped entity.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity access should be checked for.
* @param string $op
* The operation to be performed. Possible values are:
* - "view"
* - "update"
* - "delete"
* - "create"
*
* @return
* TRUE if the user is allowed to perform the given operation, FALSE
* otherwise.
*/
public function getAccess(EntityInterface $entity, $op);
/** /**
* Checks if the user can perform the given operation on translations of the * Checks if the user can perform the given operation on translations of the
* wrapped entity. * wrapped entity.
......
...@@ -14,13 +14,6 @@ ...@@ -14,13 +14,6 @@
*/ */
class ContentTranslationControllerNG extends ContentTranslationController { class ContentTranslationControllerNG extends ContentTranslationController {
/**
* Overrides \Drupal\content_translation\ContentTranslationController::getAccess().
*/
public function getAccess(EntityInterface $entity, $op) {
return $entity->access($op);
}
/** /**
* Overrides \Drupal\content_translation\ContentTranslationControllerInterface::removeTranslation(). * Overrides \Drupal\content_translation\ContentTranslationControllerInterface::removeTranslation().
*/ */
......
...@@ -15,13 +15,6 @@ ...@@ -15,13 +15,6 @@
*/ */
class NodeTranslationController extends ContentTranslationController { class NodeTranslationController extends ContentTranslationController {
/**
* Overrides ContentTranslationController::getAccess().
*/
public function getAccess(EntityInterface $entity, $op) {
return node_access($op, $entity);
}
/** /**
* Overrides ContentTranslationController::entityFormAlter(). * Overrides ContentTranslationController::entityFormAlter().
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment