diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/block/block/CategoryBlock.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/block/block/CategoryBlock.php index b4acb0c..6ef1700 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/block/block/CategoryBlock.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/block/block/CategoryBlock.php @@ -24,18 +24,19 @@ class CategoryBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::settings(). + * Provide a default of 10 for the block_count configuration. */ - public function settings() { + public function blockSettings() { return array( 'block_count' => 10, ); } /** - * Overrides \Drupal\block\BlockBase::access(). + * Check to make sure the user has the 'access news feeds' permission before + * allowing access to this block's output. */ - public function access() { + public function blockAccess() { return user_access('access news feeds'); } @@ -60,7 +61,7 @@ public function configureSubmit($form, &$form_state) { } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { $id = $this->getPluginId(); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/block/block/FeedBlock.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/block/block/FeedBlock.php index 1c57d91..c6f8e4a 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/block/block/FeedBlock.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/block/block/FeedBlock.php @@ -24,18 +24,19 @@ class FeedBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::settings(). + * Provide a default of 10 for the block_count configuration. */ - public function settings() { + public function blockSettings() { return array( 'block_count' => 10, ); } /** - * Overrides \Drupal\block\BlockBase::access(). + * Check to make sure the user has the 'access news feeds' permission before + * allowing access to this block's output. */ - public function access() { + public function blockAccess() { return user_access('access news feeds'); } @@ -60,7 +61,7 @@ public function configureSubmit($form, &$form_state) { } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { // Plugin IDs look something like this: aggregator_feed_block:1. diff --git a/core/modules/block/block.admin.inc b/core/modules/block/block.admin.inc index 6edf8ee..5b6f100 100644 --- a/core/modules/block/block.admin.inc +++ b/core/modules/block/block.admin.inc @@ -265,7 +265,7 @@ function block_admin_configure($form, &$form_state, $plugin_id, $theme = NULL) { '#type' => 'value', '#value' => $theme, ); - $form += $instance->configureWrapper($form, $form_state); + $form += $instance->form($form, $form_state); return $form; } @@ -276,7 +276,7 @@ function block_admin_configure($form, &$form_state, $plugin_id, $theme = NULL) { * @see block_admin_configure_submit() */ function block_admin_configure_validate($form, &$form_state) { - $form['#instance']->configureValidateWrapper($form, $form_state); + $form['#instance']->validate($form, $form_state); } /** @@ -286,7 +286,7 @@ function block_admin_configure_validate($form, &$form_state) { * @see block_admin_configure_validate() */ function block_admin_configure_submit($form, &$form_state) { - $form['#instance']->configureSubmitWrapper($form, $form_state); + $form['#instance']->submit($form, $form_state); $config_values = $form['#instance']->getConfig(); $machine_name = 'plugin.core.block.' . $form_state['values']['theme'] . '.' . $form_state['values']['machine_name']; $config = config($machine_name); diff --git a/core/modules/block/block.module b/core/modules/block/block.module index f242d6d..fd8ded1 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -512,7 +512,7 @@ function _block_load_blocks() { function _block_get_renderable_block($element) { $block = $element['#block']; // Don't bother to build blocks that aren't accessible. - if ($element['#access'] = $block->accessWrapper()) { + if ($element['#access'] = $block->access()) { $build = block_build($block); if ($build) { if (isset($build['#title'])) { diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/block/block/CustomBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/block/block/CustomBlock.php index 9155b54..11d338b 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/block/block/CustomBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/block/block/CustomBlock.php @@ -19,17 +19,22 @@ * module = "custom_block", * derivative = "Drupal\custom_block\Plugin\Derivative\CustomBlock", * custom = "TRUE", - * settings = { - * "status" = TRUE, - * "info" = "", - * "body" = "", - * "format" = NULL - * } * ) */ class CustomBlock extends BlockBase { /** + * Set a blank info, body and NULL format for use in the configure method. + */ + public function blockSettings() { + return array( + 'info' => '', + 'body' => '', + 'format' => NULL, + ); + } + + /** * Overrides \Drupal\block\BlockBase::getConfig(). */ public function getConfig() { @@ -46,7 +51,6 @@ public function getConfig() { * Overrides \Drupal\block\BlockBase::configure(). */ public function configure($form, &$form_state) { - $form = parent::configure($form, $form_state); $form['custom_block']['info'] = array( '#type' => 'textfield', '#title' => t('Block description'), @@ -77,7 +81,6 @@ public function configure($form, &$form_state) { * Overrides \Drupal\block\BlockBase::configureSubmit(). */ public function configureSubmit($form, &$form_state) { - parent::configureSubmit($form, $form_state); list(, $bid) = explode(':', $this->getPluginId()); $block = array( 'info' => $form_state['values']['info'], @@ -90,7 +93,7 @@ public function configureSubmit($form, &$form_state) { } /** - * Overrides \Drupal\block\BlockBase::build(); + * Implements \Drupal\block\BlockInterface::build(); */ public function build() { return array( diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php index 514fa9e..bdade2c 100644 --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -19,10 +19,10 @@ abstract class BlockBase extends PluginBase implements BlockInterface { /** - * Implements \Drupal\block\BlockInterface::settingsWrapper(). + * Implements \Drupal\block\BlockInterface::settings(). */ - public function settingsWrapper() { - $settings = $this->settings(); + public function settings() { + $settings = $this->blockSettings(); $settings += array( 'status' => TRUE, 'cache' => DRUPAL_NO_CACHE, @@ -31,18 +31,25 @@ public function settingsWrapper() { } /** - * Implements \Drupal\block\BlockInterface::settings(). + * This provides a sane default for local block settings so that they needn't + * implement this method when they don't have any custom settings to provide. + * + * @return array() */ - public function settings() { + public function blockSettings() { return array(); } /** - * Implements \Drupal\block\BlockInterface::getConfig(). + * This is a getter for the protected configuration variable provided by the + * PluginBase abstract class. + * + * @todo this should be abstracted and moved out into a configuration + * sensative plugin base class for broader use. */ public function getConfig() { if (empty($this->configuration)) { - $this->configuration = $this->settingsWrapper(); + $this->configuration = $this->settings(); // @todo This loads the default subject. Is this the right place to do so? $definition = $this->getDefinition(); @@ -53,22 +60,32 @@ public function getConfig() { return $this->configuration; } + /** + * This is a setter for the protected $configuration variable provided by the + * PluginBase abstract class. + * + * @todo this should be abstracted and moved out into a configuration + * sensative plugin base class for broader use. + */ public function setConfig($key, $value) { $this->configuration[$key] = $value; } /** - * Implements \Drupal\block\BlockInterface::access(). + * This provides a sane default for local block access so that they needn't + * implement this method when they don't have any custom access to provide. + * + * @return bool */ - public function access() { + public function blockAccess() { return TRUE; } /** - * Implements \Drupal\block\BlockInterface::accessWrapper(). + * Implements \Drupal\block\BlockInterface::access(). */ - public function accessWrapper() { - if ($this->access()) { + public function access() { + if ($this->blockAccess()) { global $user, $theme_key; // Status handling. if (empty($this->configuration['status'])) { @@ -140,9 +157,9 @@ public function accessWrapper() { } /** - * Implements \Drupal\block\BlockInterface::configureWrapper(). + * Implements \Drupal\block\BlockInterface::form(). */ - public function configureWrapper($form, &$form_state) { + public function form($form, &$form_state) { $definition = $this->getDefinition(); $config = $this->getConfig(); $form['id'] = array( @@ -357,16 +374,19 @@ public function configureWrapper($form, &$form_state) { } /** - * Implements \Drupal\block\BlockInterface::configure(). + * A default form implementation for blocks that don't need any additional + * configuration beyond what is provided by default. + * + * @return array() */ public function configure($form, &$form_state) { return array(); } /** - * Implements \Drupal\block\BlockInterface::configureValidateWrapper(). + * Implements \Drupal\block\BlockInterface::validate(). */ - public function configureValidateWrapper($form, &$form_state) { + public function validate($form, &$form_state) { if (empty($form['settings']['machine_name']['#disabled'])) { if (preg_match('/[^a-zA-Z0-9_]/', $form_state['values']['machine_name'])) { form_set_error('machine_name', t('Block name must be alphanumeric or underscores only.')); @@ -393,14 +413,15 @@ public function configureValidateWrapper($form, &$form_state) { } /** - * Implements \Drupal\block\BlockInterface::configureValidate(). + * A default form validation implementation for blocks that don't need any + * additional form validation beyond what is provided by default. */ public function configureValidate($form, &$form_state) {} /** - * Implements \Drupal\block\BlockInterface::configureSubmitWrapper(). + * Implements \Drupal\block\BlockInterface::submit(). */ - public function configureSubmitWrapper($form, &$form_state) { + public function submit($form, &$form_state) { if (!form_get_errors()) { $transaction = db_transaction(); try { @@ -433,9 +454,8 @@ public function configureSubmitWrapper($form, &$form_state) { } /** - * Implements \Drupal\block\BlockInterface::configureSubmit(). + * A default form submission implementation for blocks that don't need any + * additional form submission beyond what is provided by default. */ - public function configureSubmit($form, &$form_state) { - } - + public function configureSubmit($form, &$form_state) {} } diff --git a/core/modules/block/lib/Drupal/block/BlockInterface.php b/core/modules/block/lib/Drupal/block/BlockInterface.php index c152ea2..9d52711 100644 --- a/core/modules/block/lib/Drupal/block/BlockInterface.php +++ b/core/modules/block/lib/Drupal/block/BlockInterface.php @@ -21,64 +21,34 @@ public function settings(); /** * Indicates whether the block should be shown, based on general criteria. * - * This method should enforce the general contracts that are generally - * applicable to all blocks: role, path, and page-based visibility settings. + * This method should enforce the contract that is applicable to all blocks: + * role, path, and page-based visibility settings. * - * This is the method that is typically called externally, so implementations - * of it should make sure to also call BlockInterface::access() and AND the - * result with their own result to provide the final access determination. - * - * @return bool - */ - public function accessWrapper(); - - /** - * Indicates whether the block should be shown, based on internal criteria. - * - * Blocks with access control that should *always* be applied, regardless of - * user-configured settings, should implement this method with that access - * control logic. + * This is the method that is typically called externally, so new base class + * implementations of it should likely call the abstract method + * $this->localAccess() and AND the result with their own result to provide + * the final access determination. * * @return bool */ public function access(); /** - * Returns the configuration form elements specific to this block plugin. - * - * @return array $form - */ - public function configure($form, &$form_state); - - /** - * The validation wrapper for the configuration form. - */ - public function configureValidate($form, &$form_state); - - /** - * The submission wrapper for the configuration form. - */ - public function configureSubmit($form, &$form_state); - - /** - * Returns the full form for block configuration. - * - * This incorporates both + * Returns a configuration form. * * @return array $form - * The renderable form array representing the entire configuration form. */ - public function configureWrapper($form, &$form_state); + public function form($form, &$form_state); /** - * The validation for the configuration form. + * Validates the configuration form. */ - public function configureValidateWrapper($form, &$form_state); + public function validate($form, &$form_state); /** - * The submission for the configuration form. + * Submits the configuration form. */ - public function configureSubmitWrapper($form, &$form_state); + public function submit($form, &$form_state); /** * Builds and returns the renderable array for this block. diff --git a/core/modules/block/tests/lib/Drupal/block_test/Plugin/block/block/TestCacheBlock.php b/core/modules/block/tests/lib/Drupal/block_test/Plugin/block/block/TestCacheBlock.php index 878806a..9ed959f 100644 --- a/core/modules/block/tests/lib/Drupal/block_test/Plugin/block/block/TestCacheBlock.php +++ b/core/modules/block/tests/lib/Drupal/block_test/Plugin/block/block/TestCacheBlock.php @@ -23,16 +23,18 @@ class TestCacheBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::settings(). + * Overrides \Drupal\block\BlockBase::blockSettings(). + * + * Sets a different caching strategy for testing purposes. */ - public function settings() { + public function blockSettings() { return array( 'cache' => DRUPAL_CACHE_PER_ROLE, ); } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(); */ public function build() { return array( diff --git a/core/modules/book/lib/Drupal/book/Plugin/block/block/BookNavigationBlock.php b/core/modules/book/lib/Drupal/book/Plugin/block/block/BookNavigationBlock.php index c4b1f5c..af44918 100644 --- a/core/modules/book/lib/Drupal/book/Plugin/block/block/BookNavigationBlock.php +++ b/core/modules/book/lib/Drupal/book/Plugin/block/block/BookNavigationBlock.php @@ -23,9 +23,9 @@ class BookNavigationBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::settings(). + * Overrides \Drupal\block\BlockBase::blockSettings(). */ - public function settings() { + public function blockSettings() { return array( 'cache' => DRUPAL_CACHE_PER_PAGE | DRUPAL_CACHE_PER_ROLE, 'block_mode' => "all pages", @@ -59,7 +59,7 @@ public function configureSubmit($form, &$form_state) { } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { $current_bid = 0; diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/block/block/RecentBlock.php b/core/modules/comment/lib/Drupal/comment/Plugin/block/block/RecentBlock.php index da49bd8..330e272 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/block/block/RecentBlock.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/block/block/RecentBlock.php @@ -23,9 +23,9 @@ class RecentBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::settings(). + * Overrides \Drupal\block\BlockBase::blockSettings(). */ - public function settings() { + public function blockSettings() { return array( 'block_count' => 10, ); @@ -34,7 +34,7 @@ public function settings() { /** * Overrides \Drupal\block\BlockBase::access(). */ - public function access() { + public function blockAccess() { return user_access('access comments'); } @@ -59,7 +59,7 @@ public function configureSubmit($form, &$form_state) { } /** - * Overrides \Drupal\block\BlockBase::build(); + * Implements \Drupal\block\BlockInterface::build(); */ public function build() { return array( diff --git a/core/modules/forum/lib/Drupal/forum/Plugin/block/block/ActiveBlock.php b/core/modules/forum/lib/Drupal/forum/Plugin/block/block/ActiveBlock.php index 4abf273..a64ab75 100644 --- a/core/modules/forum/lib/Drupal/forum/Plugin/block/block/ActiveBlock.php +++ b/core/modules/forum/lib/Drupal/forum/Plugin/block/block/ActiveBlock.php @@ -22,7 +22,7 @@ class ActiveBlock extends ForumBlockBase { /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { $query = db_select('forum_index', 'f') diff --git a/core/modules/forum/lib/Drupal/forum/Plugin/block/block/ForumBlockBase.php b/core/modules/forum/lib/Drupal/forum/Plugin/block/block/ForumBlockBase.php index d11a9e4..38fb58b 100644 --- a/core/modules/forum/lib/Drupal/forum/Plugin/block/block/ForumBlockBase.php +++ b/core/modules/forum/lib/Drupal/forum/Plugin/block/block/ForumBlockBase.php @@ -15,9 +15,9 @@ abstract class ForumBlockBase extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::settings(). + * Overrides \Drupal\block\BlockBase::blockSettings(). */ - public function settings() { + public function blockSettings() { return array( 'cache' => DRUPAL_CACHE_CUSTOM, 'properties' => array( @@ -28,9 +28,9 @@ public function settings() { } /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function access() { + public function blockAccess() { return user_access('access content'); } diff --git a/core/modules/forum/lib/Drupal/forum/Plugin/block/block/NewBlock.php b/core/modules/forum/lib/Drupal/forum/Plugin/block/block/NewBlock.php index 944d8a8..f3fa12e 100644 --- a/core/modules/forum/lib/Drupal/forum/Plugin/block/block/NewBlock.php +++ b/core/modules/forum/lib/Drupal/forum/Plugin/block/block/NewBlock.php @@ -22,7 +22,7 @@ class NewBlock extends ForumBlockBase { /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { $query = db_select('forum_index', 'f') diff --git a/core/modules/language/lib/Drupal/language/Plugin/block/block/LanguageBlock.php b/core/modules/language/lib/Drupal/language/Plugin/block/block/LanguageBlock.php index 32897cb..f303211 100644 --- a/core/modules/language/lib/Drupal/language/Plugin/block/block/LanguageBlock.php +++ b/core/modules/language/lib/Drupal/language/Plugin/block/block/LanguageBlock.php @@ -24,14 +24,14 @@ class LanguageBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - function access() { + function blockAccess() { return language_multilingual(); } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ function build() { $path = drupal_is_front_page() ? '' : current_path(); diff --git a/core/modules/node/lib/Drupal/node/Plugin/block/block/RecentBlock.php b/core/modules/node/lib/Drupal/node/Plugin/block/block/RecentBlock.php index b470d7b..e2db67f 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/block/block/RecentBlock.php +++ b/core/modules/node/lib/Drupal/node/Plugin/block/block/RecentBlock.php @@ -23,18 +23,18 @@ class RecentBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::settings(). + * Overrides \Drupal\block\BlockBase::blockSettings(). */ - public function settings() { + public function blockSettings() { return array( 'block_count' => 10, ); } /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function access() { + public function blockAccess() { return user_access('access content'); } @@ -59,7 +59,7 @@ public function configureSubmit($form, &$form_state) { } /** - * Overrides \Drupal\block\BlockBase::build(); + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { if ($nodes = node_get_recent($this->configuration['block_count'])) { diff --git a/core/modules/node/lib/Drupal/node/Plugin/block/block/SyndicateBlock.php b/core/modules/node/lib/Drupal/node/Plugin/block/block/SyndicateBlock.php index beb04db..8c02266 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/block/block/SyndicateBlock.php +++ b/core/modules/node/lib/Drupal/node/Plugin/block/block/SyndicateBlock.php @@ -23,23 +23,23 @@ class SyndicateBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::settings(). + * Overrides \Drupal\block\BlockBase::blockSettings(). */ - public function settings() { + public function blockSettings() { return array( 'block_count' => 10, ); } /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function access() { + public function blockAccess() { return user_access('access content'); } /** - * Overrides \Drupal\block\BlockBase::build(); + * Implements \Drupal\block\BlockInterface::build(); */ public function build() { return array( diff --git a/core/modules/poll/lib/Drupal/poll/Plugin/block/block/PollRecentBlock.php b/core/modules/poll/lib/Drupal/poll/Plugin/block/block/PollRecentBlock.php index d9b08e4..67c13ab 100644 --- a/core/modules/poll/lib/Drupal/poll/Plugin/block/block/PollRecentBlock.php +++ b/core/modules/poll/lib/Drupal/poll/Plugin/block/block/PollRecentBlock.php @@ -30,9 +30,9 @@ class PollRecentBlock extends BlockBase { protected $record; /** - * Overrides \Drupal\block\BlockBase::settings(). + * Overrides \Drupal\block\BlockBase::blockSettings(). */ - public function settings() { + public function blockSettings() { return array( 'properties' => array( 'administrative' => TRUE, @@ -43,7 +43,7 @@ public function settings() { /** * Overrides \Drupal\block\BlockBase::access(). */ - public function access() { + public function blockAccess() { if (user_access('access content')) { // Retrieve the latest poll. $select = db_select('node', 'n'); @@ -65,7 +65,7 @@ public function access() { } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { $poll = node_load($this->record); diff --git a/core/modules/search/lib/Drupal/search/Plugin/block/block/SearchBlock.php b/core/modules/search/lib/Drupal/search/Plugin/block/block/SearchBlock.php index cd24ac6..a6fbb04 100644 --- a/core/modules/search/lib/Drupal/search/Plugin/block/block/SearchBlock.php +++ b/core/modules/search/lib/Drupal/search/Plugin/block/block/SearchBlock.php @@ -23,14 +23,14 @@ class SearchBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function access() { + public function blockAccess() { return user_access('search content'); } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { return array(drupal_get_form('search_block_form')); diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Plugin/block/block/ShortcutsBlock.php b/core/modules/shortcut/lib/Drupal/shortcut/Plugin/block/block/ShortcutsBlock.php index e9f445d..7638a29 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Plugin/block/block/ShortcutsBlock.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Plugin/block/block/ShortcutsBlock.php @@ -23,7 +23,7 @@ class ShortcutsBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { return array( diff --git a/core/modules/statistics/lib/Drupal/statistics/Plugin/block/block/StatisticsPopularBlock.php b/core/modules/statistics/lib/Drupal/statistics/Plugin/block/block/StatisticsPopularBlock.php index 6465a2a..c288d60 100644 --- a/core/modules/statistics/lib/Drupal/statistics/Plugin/block/block/StatisticsPopularBlock.php +++ b/core/modules/statistics/lib/Drupal/statistics/Plugin/block/block/StatisticsPopularBlock.php @@ -44,9 +44,9 @@ class StatisticsPopularBlock extends BlockBase { protected $last_list; /** - * Overrides \Drupal\block\BlockBase::settings(). + * Overrides \Drupal\block\BlockBase::blockSettings(). */ - public function settings() { + public function blockSettings() { return array( 'top_day_num' => 0, 'top_all_num' => 0, @@ -55,9 +55,9 @@ public function settings() { } /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function access() { + public function blockAccess() { if (user_access('access content')) { $daytop = $this->configuration['top_day_num']; if (!$daytop || !($result = statistics_title_list('daycount', $daytop)) || !($this->day_list = node_title_list($result, t("Today's:")))) { @@ -116,7 +116,7 @@ public function configureSubmit($form, &$form_state) { } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { $content = array(); diff --git a/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemHelpBlock.php b/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemHelpBlock.php index 34b68ad..ac50042 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemHelpBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemHelpBlock.php @@ -30,15 +30,15 @@ class SystemHelpBlock extends BlockBase { protected $help; /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function access() { + public function blockAccess() { $this->help = menu_get_active_help(); return (bool) $this->help; } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { return array( diff --git a/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemMainBlock.php b/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemMainBlock.php index b2cffa6..21e4268 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemMainBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemMainBlock.php @@ -23,7 +23,7 @@ class SystemMainBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { return array( diff --git a/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemMenuBlock.php b/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemMenuBlock.php index 5c95a5f..6d3b837 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemMenuBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemMenuBlock.php @@ -24,16 +24,16 @@ class SystemMenuBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function access() { + public function blockAccess() { // @todo The 'Tools' menu should be available to anonymous users. list($plugin, $derivative) = explode(':', $this->getPluginId()); return ($GLOBALS['user']->uid || in_array($derivative, array('menu-tools', 'menu-footer'))); } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { list($plugin, $derivative) = explode(':', $this->getPluginId()); diff --git a/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemPoweredByBlock.php b/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemPoweredByBlock.php index 82bf742..4b94df0 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemPoweredByBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/block/block/SystemPoweredByBlock.php @@ -23,7 +23,7 @@ class SystemPoweredByBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { return array( diff --git a/core/modules/user/lib/Drupal/user/Plugin/block/block/UserLoginBlock.php b/core/modules/user/lib/Drupal/user/Plugin/block/block/UserLoginBlock.php index 63e4be4..4ca502c 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/block/block/UserLoginBlock.php +++ b/core/modules/user/lib/Drupal/user/Plugin/block/block/UserLoginBlock.php @@ -23,14 +23,14 @@ class UserLoginBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function access() { + public function blockAccess() { return (!$GLOBALS['user']->uid && !(arg(0) == 'user' && !is_numeric(arg(1)))); } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { $form = drupal_get_form('user_login_form'); diff --git a/core/modules/user/lib/Drupal/user/Plugin/block/block/UserNewBlock.php b/core/modules/user/lib/Drupal/user/Plugin/block/block/UserNewBlock.php index 89b9131..6669372 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/block/block/UserNewBlock.php +++ b/core/modules/user/lib/Drupal/user/Plugin/block/block/UserNewBlock.php @@ -23,9 +23,9 @@ class UserNewBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::settings(). + * Overrides \Drupal\block\BlockBase::blockSettings(). */ - public function settings() { + public function blockSettings() { return array( 'properties' => array( 'administrative' => TRUE @@ -35,9 +35,9 @@ public function settings() { } /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function access() { + public function blockAccess() { return user_access('access content'); } @@ -62,7 +62,7 @@ public function configureSubmit($form, &$form_state) { } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { // Retrieve a list of new users who have accessed the site successfully. diff --git a/core/modules/user/lib/Drupal/user/Plugin/block/block/UserOnlineBlock.php b/core/modules/user/lib/Drupal/user/Plugin/block/block/UserOnlineBlock.php index 1253c71..b37d8ec 100644 --- a/core/modules/user/lib/Drupal/user/Plugin/block/block/UserOnlineBlock.php +++ b/core/modules/user/lib/Drupal/user/Plugin/block/block/UserOnlineBlock.php @@ -26,9 +26,9 @@ class UserOnlineBlock extends BlockBase { /** - * Overrides \Drupal\block\BlockBase::settings(). + * Overrides \Drupal\block\BlockBase::blockSettings(). */ - public function settings() { + public function blockSettings() { return array( 'properties' => array( 'administrative' => TRUE @@ -39,9 +39,9 @@ public function settings() { } /** - * Overrides \Drupal\block\BlockBase::access(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function access() { + public function blockAccess() { return user_access('access content'); } @@ -76,7 +76,7 @@ public function configureSubmit($form, &$form_state) { } /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { // Count users active within the defined period. diff --git a/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsBlock.php b/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsBlock.php index 98330e3..1110241 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsBlock.php +++ b/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsBlock.php @@ -52,11 +52,16 @@ public function __construct(array $configuration, $plugin_id, DiscoveryInterface } /** - * Overrides \Drupal\block\BlockBase::configureWrapper(). + * Overrides \Drupal\block\BlockBase::blockAccess(). */ - public function configureWrapper($form, &$form_state) { - $form = parent::configureWrapper($form, $form_state); + public function blockAccess() { + return $this->view->access($this->displayID); + } + /** + * Overrides \Drupal\block\BlockBase::configure(). + */ + public function configure($form, &$form_state) { // Set the default subject to '' so the views internal title is used. $form['settings']['title']['#default_value'] = ''; $form['settings']['title']['#access'] = FALSE; @@ -64,14 +69,7 @@ public function configureWrapper($form, &$form_state) { } /** - * Overrides \Drupal\block\BlockBase::access(). - */ - public function access() { - return $this->view->access($this->displayID); - } - - /** - * Overrides \Drupal\block\BlockBase::build(). + * Implements \Drupal\block\BlockInterface::build(). */ public function build() { $output = $this->view->executeDisplay($this->displayID); diff --git a/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsExposedFilterBlock.php b/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsExposedFilterBlock.php index 835978a..f274913 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsExposedFilterBlock.php +++ b/core/modules/views/lib/Drupal/views/Plugin/block/block/ViewsExposedFilterBlock.php @@ -23,7 +23,7 @@ class ViewsExposedFilterBlock extends ViewsBlock { /** - * Overrides \Drupal\block\BlockBase::build(). + * Overrides \Drupal\views\Plugin\block\block\ViewsBlock::build(). */ public function build() { $type = 'exp';