From b2ba9ca6c9162c50ff0dc32c918960235f757365 Mon Sep 17 00:00:00 2001 From: dereine <dereine@99340.no-reply.drupal.org> Date: Thu, 6 Sep 2012 23:28:43 +0200 Subject: [PATCH] Issue #1777004 by dawehner: Added Mark access/get_access_callback() as abstract on the access plugin base to force an implementation. --- .../Plugin/views/access/AccessPluginBase.php | 24 +++++++++---------- lib/Drupal/views/Plugin/views/access/None.php | 16 +++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php b/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php index db06b5c79507..5163a90c4c32 100644 --- a/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php +++ b/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php @@ -72,11 +72,14 @@ public function summaryTitle() { /** * Determine if the current user has access or not. + * + * @param Drupal\user\User $account + * The user who wants to access this view. + * + * @return TRUE + * Returns whether the user has access to the view. */ - public function access($account) { - // default to no access control. - return TRUE; - } + abstract public function access($account); /** * Determine the access callback and arguments. @@ -85,15 +88,12 @@ public function access($account) { * performance hits during menu item access testing, which happens * a lot. * - * @return an array; the first item should be the function to call, - * and the second item should be an array of arguments. The first - * item may also be TRUE (bool only) which will indicate no - * access control.) + * @return array + * The first item of the array should be the function to call,and the + * second item should be an array of arguments. The first item may also be + * TRUE (bool only) which will indicate no access control. */ - function get_access_callback() { - // default to no access control. - return TRUE; - } + abstract function get_access_callback(); } diff --git a/lib/Drupal/views/Plugin/views/access/None.php b/lib/Drupal/views/Plugin/views/access/None.php index 55c589ee5682..923598c257a2 100644 --- a/lib/Drupal/views/Plugin/views/access/None.php +++ b/lib/Drupal/views/Plugin/views/access/None.php @@ -27,4 +27,20 @@ public function summaryTitle() { return t('Unrestricted'); } + /** + * Implements Drupal\views\Plugin\views\access\AccessPluginBase::access(). + */ + public function access($account) { + // No access control. + return TRUE; + } + + /** + * Implements Drupal\views\Plugin\views\access\AccessPluginBase::get_access_callback(). + */ + public function get_access_callback() { + // No access control. + return TRUE; + } + } -- GitLab