diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php index 31e355c..6c84948 100644 --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -13,7 +13,6 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Language\Language; use Drupal\Core\Cache\Cache; -use Drupal\Core\Cache\CacheableInterface; use Drupal\Core\Session\AccountInterface; /** @@ -126,7 +125,7 @@ public function buildConfigurationForm(array $form, array &$form_state) { '#type' => 'textfield', '#title' => $this->t('Title'), '#maxlength' => 255, - '#default_value' => !empty($this->configuration['label']) ? $this->configuration['label'] : $this->getDefaultTitle(), + '#default_value' => !empty($this->configuration['label']) ? $this->configuration['label'] : $this->getRawLabel(), '#required' => TRUE, ); $form['label_display'] = array( @@ -293,7 +292,7 @@ public function getCacheTags() { /** * {@inheritdoc} */ - public function getDefaultTitle() { + public function getDefaultLabel() { // @todo this connects the wrong dots, but it works for a first-draft patch. $definition = $this->getPluginDefinition(); return $definition['admin_label']; @@ -302,17 +301,17 @@ public function getDefaultTitle() { /** * {@inheritdoc} */ - public function getRawTitle() { + public function getRawLabel() { $configuration = $this->getConfiguration(); // Override titles should supersede native title logic. - return isset($configuration['label']) ? $configuration['label'] : $this->getDefaultTitle(); + return isset($configuration['label']) ? $configuration['label'] : $this->getDefaultLabel(); } /** * {@inheritdoc} */ - public function getTitle() { - return $this->getRawTitle(); + public function getLabel() { + return $this->getRawLabel(); // @todo add tokenization based on context as default approach // once https://drupal.org/node/2024783 is in. } @@ -320,7 +319,7 @@ public function getTitle() { /** * {@inheritdoc} */ - public function isTitleVisible() { + public function isLabelVisible() { // Assume the title is visible if the setting does not exist. if (!isset($this->configuration['label_display'])) { return TRUE; diff --git a/core/modules/block/lib/Drupal/block/BlockPluginInterface.php b/core/modules/block/lib/Drupal/block/BlockPluginInterface.php index bcc058f..8a3c189 100644 --- a/core/modules/block/lib/Drupal/block/BlockPluginInterface.php +++ b/core/modules/block/lib/Drupal/block/BlockPluginInterface.php @@ -128,13 +128,13 @@ public function blockSubmit($form, &$form_state); public function getMachineNameSuggestion(); /** - * Gets the default, unprocessed, frontend-facing title for this block. + * Gets the default, unprocessed, frontend-facing label for this block. * - * This title should be the block's suggestion of a sane title for frontend - * display to the end user. If this block's title changes based on injected + * This label should be the block's suggestion of a sane label for frontend + * display to the end user. If this block's label changes based on injected * contextual data, then this string should contain the relevant tokens. * - * It must be possible to produce this title with neither configuration nor + * It must be possible to produce this label with neither configuration nor * contextual data having been injected into the block. * * The block is responsible for filtering this string appropriately if it @@ -142,33 +142,33 @@ public function getMachineNameSuggestion(); * * @return string */ - public function getDefaultTitle(); + public function getDefaultLabel(); /** - * Gets the unprocessed user-facing title for this block. + * Gets the unprocessed user-facing label for this block. * * This method should allow user configuration to modify or fully replace the - * suggested title returned from BlockPluginInterface::getDefaultTitle() - * based on user configuration. As with that default title, returning a string + * suggested label returned from BlockPluginInterface::getDefaultLabel() + * based on user configuration. As with that default label, returning a string * with raw tokens in it is appropriate. * * If the relevant configuration is not present, or if the Block chooses not - * to allow any user modification of the title output, this method should - * simply defer to BlockPluginInterface::getDefaultTitle(). + * to allow any user modification of the label output, this method should + * simply defer to BlockPluginInterface::getDefaultLabel(). * * This string may contain user input, and should be filtered accordingly. * * @return string * - * @see \Drupal\Block\BlockPluginInterface::getDefaultTitle() + * @see \Drupal\Block\BlockPluginInterface::getDefaultLabel() */ - public function getRawTitle(); + public function getRawLabel(); /** * Gets the fully-prepared user-facing title for this block. * * In the simple case, this method should take the output of - * BlockPluginInterface::getRawTitle(), apply any transformational logic to it + * BlockPluginInterface::getRawLabel(), apply any transformational logic to it * that requires injected contextual data, and return the result. * * This method should not be called unless a block has had both configuration @@ -178,16 +178,16 @@ public function getRawTitle(); * * @return string * - * @see \Drupal\Block\BlockPluginInterface::getDefaultTitle() - * @see \Drupal\Block\BlockPluginInterface::getRawTitle() + * @see \Drupal\Block\BlockPluginInterface::getDefaultLabel() + * @see \Drupal\Block\BlockPluginInterface::getRawLabel() */ - public function getTitle(); + public function getLabel(); /** - * Indicates whether the block title should be shown on the frontend. + * Indicates whether the block label should be shown on the frontend. * * @return bool */ - public function isTitleVisible(); + public function isLabelVisible(); } diff --git a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php index ca72621..19db69d 100644 --- a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php +++ b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php @@ -11,9 +11,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityViewBuilder; -use Drupal\Core\Entity\EntityViewBuilderInterface; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\Plugin\DataType\StringItem; /** * Provides a Block view builder. @@ -66,7 +64,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la // @todo Remove after fixing http://drupal.org/node/1989568. '#block' => $entity, ); - $build[$entity_id]['#configuration']['label'] = String::checkPlain($plugin->getTitle()); + $build[$entity_id]['#configuration']['label'] = String::checkPlain($plugin->getLabel()); // Set cache tags; these always need to be set, whether the block is // cacheable or not, so that the page cache is correctly informed. diff --git a/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php b/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php index 677f051..543849a 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php @@ -7,9 +7,7 @@ namespace Drupal\views\Plugin\Block; -use Drupal\Core\Config\Entity\Query\Query; use Drupal\Component\Utility\Xss; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides a generic Views block.