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 @@
*
* @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 {
......
......@@ -21,7 +21,8 @@
*
* @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 {
......
......@@ -21,6 +21,7 @@
* @Block(
* id = "custom_block",
* admin_label = @Translation("Custom block"),
* category = @Translation("Custom"),
* derivative = "Drupal\custom_block\Plugin\Derivative\CustomBlock"
* )
*/
......
......@@ -47,7 +47,7 @@ protected function defineOptions() {
$options = parent::defineOptions();
$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_hide_empty'] = array('default' => FALSE);
......@@ -364,17 +364,6 @@ public function usesExposed() {
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().
*/
......
......@@ -66,7 +66,7 @@ public function testBlockCategory() {
// Test that the block was given a default category corresponding to its
// base table.
$arguments = array(
':id' => 'edit-category-views-test-data',
':id' => 'edit-category-lists-views',
':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-1',
':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_1/stark'),
':text' => $edit['label'],
......@@ -81,7 +81,7 @@ public function testBlockCategory() {
// Change the block category to a random string.
$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));
$this->assertTrue(!empty($link));
$this->clickLink($label);
......@@ -102,7 +102,7 @@ public function testBlockCategory() {
$this->assertTrue(!empty($elements), 'The test block appears in the custom category.');
$arguments = array(
':id' => 'edit-category-views-test-data',
':id' => 'edit-category-lists-views',
':li_class' => 'views-block' . drupal_html_class($edit['id']) . '-block-2',
':href' => url('admin/structure/block/add/views_block:' . $edit['id'] . '-block_2/stark'),
':text' => $edit['label'],
......
......@@ -16,7 +16,8 @@
*
* @Block(
* id = "book_navigation",
* admin_label = @Translation("Book navigation")
* admin_label = @Translation("Book navigation"),
* category = @Translation("Menus")
* )
*/
class BookNavigationBlock extends BlockBase {
......
......@@ -16,8 +16,9 @@
* Provides a 'Recent comments' block.
*
* @Block(
* id = "recent_comments",
* admin_label = @Translation("Recent comments")
* id = "recent_comments",
* admin_label = @Translation("Recent comments"),
* category = @Translation("Lists (Views)")
* )
*/
class RecentCommentsBlock extends BlockBase {
......
......@@ -15,7 +15,8 @@
*
* @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 {
......
......@@ -15,7 +15,8 @@
*
* @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 {
......
......@@ -18,6 +18,7 @@
* @Block(
* id = "language_block",
* admin_label = @Translation("Language switcher"),
* category = @Translation("System"),
* derivative = "Drupal\language\Plugin\Derivative\LanguageBlock"
* )
*/
......
......@@ -17,7 +17,8 @@
*
* @Block(
* id = "node_recent_block",
* admin_label = @Translation("Recent content")
* admin_label = @Translation("Recent content"),
* category = @Translation("Lists (Views)")
* )
*/
class RecentContentBlock extends BlockBase {
......
......@@ -17,7 +17,8 @@
*
* @Block(
* id = "node_syndicate_block",
* admin_label = @Translation("Syndicate")
* admin_label = @Translation("Syndicate"),
* category = @Translation("System")
* )
*/
class SyndicateBlock extends BlockBase {
......
......@@ -17,7 +17,8 @@
*
* @Block(
* id = "search_form_block",
* admin_label = @Translation("Search form")
* admin_label = @Translation("Search form"),
* category = @Translation("Forms")
* )
*/
class SearchBlock extends BlockBase {
......
......@@ -15,8 +15,9 @@
* Provides a 'Shortcut' block.
*
* @Block(
* id = "shortcuts",
* admin_label = @Translation("Shortcuts")
* id = "shortcuts",
* admin_label = @Translation("Shortcuts"),
* category = @Translation("Menus")
* )
*/
class ShortcutsBlock extends BlockBase {
......
......@@ -18,7 +18,7 @@
* @Block(
* id = "system_menu_block",
* admin_label = @Translation("Menu"),
* category = @Translation("Menu"),
* category = @Translation("Menus"),
* derivative = "Drupal\system\Plugin\Derivative\SystemMenuBlock"
* )
*/
......
......@@ -15,7 +15,8 @@
*
* @Block(
* id = "user_login_block",
* admin_label = @Translation("User login")
* admin_label = @Translation("User login"),
* category = @Translation("Forms")
* )
*/
class UserLoginBlock extends BlockBase {
......
......@@ -17,7 +17,8 @@
*
* @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 {
......
......@@ -20,7 +20,8 @@
*
* @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 {
......
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