Commit 84693769 authored by webchick's avatar webchick

Issue #2085201 by jessebeach, tim.plunkett, dawehner, yoroy: Use sensible...

Issue #2085201 by jessebeach, tim.plunkett, dawehner, yoroy: Use sensible block categories (rather than module-name categories).
parent 294d4ef9
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
* *
* @Block( * @Block(
* id = "aggregator_category_block", * id = "aggregator_category_block",
* admin_label = @Translation("Aggregator category") * admin_label = @Translation("Aggregator category"),
* category = @Translation("Lists (Views)")
* ) * )
*/ */
class AggregatorCategoryBlock extends BlockBase implements ContainerFactoryPluginInterface { class AggregatorCategoryBlock extends BlockBase implements ContainerFactoryPluginInterface {
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
* *
* @Block( * @Block(
* id = "aggregator_feed_block", * id = "aggregator_feed_block",
* admin_label = @Translation("Aggregator feed") * admin_label = @Translation("Aggregator feed"),
* category = @Translation("Lists (Views)")
* ) * )
*/ */
class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInterface { class AggregatorFeedBlock extends BlockBase implements ContainerFactoryPluginInterface {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* @Block( * @Block(
* id = "custom_block", * id = "custom_block",
* admin_label = @Translation("Custom block"), * admin_label = @Translation("Custom block"),
* category = @Translation("Custom"),
* derivative = "Drupal\custom_block\Plugin\Derivative\CustomBlock" * derivative = "Drupal\custom_block\Plugin\Derivative\CustomBlock"
* ) * )
*/ */
......
...@@ -47,7 +47,7 @@ protected function defineOptions() { ...@@ -47,7 +47,7 @@ protected function defineOptions() {
$options = parent::defineOptions(); $options = parent::defineOptions();
$options['block_description'] = array('default' => '', 'translatable' => TRUE); $options['block_description'] = array('default' => '', 'translatable' => TRUE);
$options['block_category'] = array('default' => 'Views', 'translatable' => TRUE); $options['block_category'] = array('default' => 'Lists (Views)', 'translatable' => TRUE);
$options['block_caching'] = array('default' => DRUPAL_NO_CACHE); $options['block_caching'] = array('default' => DRUPAL_NO_CACHE);
$options['block_hide_empty'] = array('default' => FALSE); $options['block_hide_empty'] = array('default' => FALSE);
...@@ -364,17 +364,6 @@ public function usesExposed() { ...@@ -364,17 +364,6 @@ public function usesExposed() {
return FALSE; return FALSE;
} }
/**
* {@inheritdoc}
*/
public function newDisplay() {
$base_tables = Views::viewsData()->fetchBaseTables();
$base_table = $this->view->storage->get('base_table');
if (isset($base_tables[$base_table]['title'])) {
$this->setOption('block_category', $base_tables[$base_table]['title']);
}
}
/** /**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::remove(). * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::remove().
*/ */
......
...@@ -66,7 +66,7 @@ public function testBlockCategory() { ...@@ -66,7 +66,7 @@ public function testBlockCategory() {
// Test that the block was given a default category corresponding to its // Test that the block was given a default category corresponding to its
// base table. // base table.
$arguments = array( $arguments = array(
':id' => 'edit-category-views-test-data', ':id' => 'edit-category-lists-views',
':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-1', ':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-1',
':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_1/stark'), ':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_1/stark'),
':text' => $edit['label'], ':text' => $edit['label'],
...@@ -81,7 +81,7 @@ public function testBlockCategory() { ...@@ -81,7 +81,7 @@ public function testBlockCategory() {
// Change the block category to a random string. // Change the block category to a random string.
$this->drupalGet('admin/structure/views/view/' . $edit['id'] . '/edit/block_1'); $this->drupalGet('admin/structure/views/view/' . $edit['id'] . '/edit/block_1');
$label = t('Views test data'); $label = t('Lists (Views)');
$link = $this->xpath('//a[@id="views-block-1-block-category" and normalize-space(text())=:label]', array(':label' => $label)); $link = $this->xpath('//a[@id="views-block-1-block-category" and normalize-space(text())=:label]', array(':label' => $label));
$this->assertTrue(!empty($link)); $this->assertTrue(!empty($link));
$this->clickLink($label); $this->clickLink($label);
...@@ -102,7 +102,7 @@ public function testBlockCategory() { ...@@ -102,7 +102,7 @@ public function testBlockCategory() {
$this->assertTrue(!empty($elements), 'The test block appears in the custom category.'); $this->assertTrue(!empty($elements), 'The test block appears in the custom category.');
$arguments = array( $arguments = array(
':id' => 'edit-category-views-test-data', ':id' => 'edit-category-lists-views',
':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-2', ':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-2',
':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_2/stark'), ':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_2/stark'),
':text' => $edit['label'], ':text' => $edit['label'],
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
* *
* @Block( * @Block(
* id = "book_navigation", * id = "book_navigation",
* admin_label = @Translation("Book navigation") * admin_label = @Translation("Book navigation"),
* category = @Translation("Menus")
* ) * )
*/ */
class BookNavigationBlock extends BlockBase { class BookNavigationBlock extends BlockBase {
......
...@@ -16,8 +16,9 @@ ...@@ -16,8 +16,9 @@
* Provides a 'Recent comments' block. * Provides a 'Recent comments' block.
* *
* @Block( * @Block(
* id = "recent_comments", * id = "recent_comments",
* admin_label = @Translation("Recent comments") * admin_label = @Translation("Recent comments"),
* category = @Translation("Lists (Views)")
* ) * )
*/ */
class RecentCommentsBlock extends BlockBase { class RecentCommentsBlock extends BlockBase {
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
* *
* @Block( * @Block(
* id = "forum_active_block", * id = "forum_active_block",
* admin_label = @Translation("Active forum topics") * admin_label = @Translation("Active forum topics"),
* category = @Translation("Lists (Views)")
* ) * )
*/ */
class ActiveTopicsBlock extends ForumBlockBase { class ActiveTopicsBlock extends ForumBlockBase {
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
* *
* @Block( * @Block(
* id = "forum_new_block", * id = "forum_new_block",
* admin_label = @Translation("New forum topics") * admin_label = @Translation("New forum topics"),
* category = @Translation("Lists (Views)")
* ) * )
*/ */
class NewTopicsBlock extends ForumBlockBase { class NewTopicsBlock extends ForumBlockBase {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
* @Block( * @Block(
* id = "language_block", * id = "language_block",
* admin_label = @Translation("Language switcher"), * admin_label = @Translation("Language switcher"),
* category = @Translation("System"),
* derivative = "Drupal\language\Plugin\Derivative\LanguageBlock" * derivative = "Drupal\language\Plugin\Derivative\LanguageBlock"
* ) * )
*/ */
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
* *
* @Block( * @Block(
* id = "node_recent_block", * id = "node_recent_block",
* admin_label = @Translation("Recent content") * admin_label = @Translation("Recent content"),
* category = @Translation("Lists (Views)")
* ) * )
*/ */
class RecentContentBlock extends BlockBase { class RecentContentBlock extends BlockBase {
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
* *
* @Block( * @Block(
* id = "node_syndicate_block", * id = "node_syndicate_block",
* admin_label = @Translation("Syndicate") * admin_label = @Translation("Syndicate"),
* category = @Translation("System")
* ) * )
*/ */
class SyndicateBlock extends BlockBase { class SyndicateBlock extends BlockBase {
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
* *
* @Block( * @Block(
* id = "search_form_block", * id = "search_form_block",
* admin_label = @Translation("Search form") * admin_label = @Translation("Search form"),
* category = @Translation("Forms")
* ) * )
*/ */
class SearchBlock extends BlockBase { class SearchBlock extends BlockBase {
......
...@@ -15,8 +15,9 @@ ...@@ -15,8 +15,9 @@
* Provides a 'Shortcut' block. * Provides a 'Shortcut' block.
* *
* @Block( * @Block(
* id = "shortcuts", * id = "shortcuts",
* admin_label = @Translation("Shortcuts") * admin_label = @Translation("Shortcuts"),
* category = @Translation("Menus")
* ) * )
*/ */
class ShortcutsBlock extends BlockBase { class ShortcutsBlock extends BlockBase {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* @Block( * @Block(
* id = "system_menu_block", * id = "system_menu_block",
* admin_label = @Translation("Menu"), * admin_label = @Translation("Menu"),
* category = @Translation("Menu"), * category = @Translation("Menus"),
* derivative = "Drupal\system\Plugin\Derivative\SystemMenuBlock" * derivative = "Drupal\system\Plugin\Derivative\SystemMenuBlock"
* ) * )
*/ */
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
* *
* @Block( * @Block(
* id = "user_login_block", * id = "user_login_block",
* admin_label = @Translation("User login") * admin_label = @Translation("User login"),
* category = @Translation("Forms")
* ) * )
*/ */
class UserLoginBlock extends BlockBase { class UserLoginBlock extends BlockBase {
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
* *
* @Block( * @Block(
* id = "user_new_block", * id = "user_new_block",
* admin_label = @Translation("Who's new") * admin_label = @Translation("Who's new"),
* category = @Translation("Lists (Views)")
* ) * )
*/ */
class UserNewBlock extends BlockBase { class UserNewBlock extends BlockBase {
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
* *
* @Block( * @Block(
* id = "user_online_block", * id = "user_online_block",
* admin_label = @Translation("Who's online") * admin_label = @Translation("Who's online"),
* category = @Translation("Lists (Views)")
* ) * )
*/ */
class UserOnlineBlock extends BlockBase { class UserOnlineBlock extends BlockBase {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment