Commit c6b2c725 authored by webchick's avatar webchick

Issue #1591806 by tim.plunkett, ryanissamson, jenlampton, Risse, psynaptic,...

Issue #1591806 by tim.plunkett, ryanissamson, jenlampton, Risse, psynaptic, Gábor Hojtsy, kmcculloch, pakmanlh, Rob Loach: Change block 'subject' so that it's called (admin_)label like everything else on the theme layer.
parent 57043315
......@@ -33,7 +33,7 @@ public function getDerivativeDefinition($derivative_id, array $base_plugin_defin
$result = db_query('SELECT cid, title FROM {aggregator_category} ORDER BY title WHERE cid = :cid', array(':cid' => $derivative_id))->fetchObject();
$this->derivatives[$derivative_id] = $base_plugin_definition;
$this->derivatives[$derivative_id]['delta'] = $result->cid;
$this->derivatives[$derivative_id]['subject'] = t('@title category latest items', array('@title' => $result->title));
$this->derivatives[$derivative_id]['admin_label'] = t('@title category latest items', array('@title' => $result->title));
return $this->derivatives[$derivative_id];
}
......@@ -46,7 +46,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
foreach ($result as $category) {
$this->derivatives[$category->cid] = $base_plugin_definition;
$this->derivatives[$category->cid]['delta'] = $category->cid;
$this->derivatives[$category->cid]['subject'] = t('@title category latest items', array('@title' => $category->title));
$this->derivatives[$category->cid]['admin_label'] = t('@title category latest items', array('@title' => $category->title));
}
return $this->derivatives;
}
......
......@@ -33,7 +33,7 @@ public function getDerivativeDefinition($derivative_id, array $base_plugin_defin
$result = db_query('SELECT fid, title, block FROM {aggregator_feed} WHERE block <> 0 AND fid = :fid', array(':fid' => $derivative_id))->fetchObject();
$this->derivatives[$derivative_id] = $base_plugin_definition;
$this->derivatives[$derivative_id]['delta'] = $result->fid;
$this->derivatives[$derivative_id]['subject'] = t('@title feed latest items', array('@title' => $result->title));
$this->derivatives[$derivative_id]['admin_label'] = t('@title feed latest items', array('@title' => $result->title));
return $this->derivatives[$derivative_id];
}
......@@ -46,7 +46,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
foreach ($result as $feed) {
$this->derivatives[$feed->fid] = $base_plugin_definition;
$this->derivatives[$feed->fid]['delta'] = $feed->fid;
$this->derivatives[$feed->fid]['subject'] = t('@title feed latest items', array('@title' => $feed->title));
$this->derivatives[$feed->fid]['admin_label'] = t('@title feed latest items', array('@title' => $feed->title));
}
return $this->derivatives;
}
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "aggregator_category_block",
* subject = @Translation("Aggregator category"),
* admin_label = @Translation("Aggregator category"),
* module = "aggregator",
* derivative = "Drupal\aggregator\Plugin\Derivative\AggregatorCategoryBlock"
* )
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "aggregator_feed_block",
* subject = @Translation("Aggregator feed"),
* admin_label = @Translation("Aggregator feed"),
* module = "aggregator",
* derivative = "Drupal\aggregator\Plugin\Derivative\AggregatorFeedBlock"
* )
......
......@@ -77,7 +77,7 @@ function block_admin_edit(Block $entity) {
$theme_title = t('!theme (administration theme)', array('!theme' => $theme_title));
}
// Get the block subject for the page title.
// Get the block label for the page title.
drupal_set_title(t("Configure %label block in %theme", array('%label' => $entity->label(), '%theme' => $theme_title)), PASS_THROUGH);
return entity_get_form($entity);
......
......@@ -477,7 +477,7 @@ function block_load($entity_id) {
}
/**
* Builds the content and subject for a block.
* Builds the content and label for a block.
*
* For cacheable blocks, this is called during #pre_render.
*
......
......@@ -46,7 +46,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
$this->derivatives[$custom_block->uuid->value]['settings'] = array(
'info' => $custom_block->info->value,
) + $base_plugin_definition['settings'];
$this->derivatives[$custom_block->uuid->value]['subject'] = $custom_block->info->value;
$this->derivatives[$custom_block->uuid->value]['admin_label'] = $custom_block->info->value;
}
return $this->derivatives;
}
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "custom_block",
* subject = @Translation("Custom Block"),
* admin_label = @Translation("Custom block"),
* module = "custom_block",
* derivative = "Drupal\custom_block\Plugin\Derivative\CustomBlock",
* settings = {
......
......@@ -70,10 +70,9 @@ public function getConfig() {
// default settings for the block plugin.
$this->configuration = $this->settings();
// @todo This loads the default subject. Is this the right place to do so?
$definition = $this->getDefinition();
if (isset($definition['subject'])) {
$this->configuration += array('subject' => $definition['subject']);
if (isset($definition['admin_label'])) {
$this->configuration += array('admin_label' => $definition['admin_label']);
}
}
// Ensure that the default cache mode is set.
......@@ -238,7 +237,7 @@ public function form($form, &$form_state) {
'#type' => 'textfield',
'#title' => t('Title'),
'#maxlength' => 255,
'#default_value' => !$entity->isNew() ? $entity->label() : $definition['subject'],
'#default_value' => !$entity->isNew() ? $entity->label() : $definition['admin_label'],
);
$form['machine_name'] = array(
'#type' => 'machine_name',
......
......@@ -138,7 +138,7 @@ public function buildForm(array $form, array &$form_state) {
foreach ($entities as $entity_id => $entity) {
$info = $entity->getPlugin()->getDefinition();
$form['blocks'][$entity_id]['info'] = array(
'#markup' => check_plain($info['subject']),
'#markup' => check_plain($info['admin_label']),
);
$form['blocks'][$entity_id]['theme'] = array(
'#type' => 'hidden',
......@@ -149,14 +149,14 @@ public function buildForm(array $form, array &$form_state) {
'#default_value' => $entity->get('weight'),
'#delta' => $weight_delta,
'#title_display' => 'invisible',
'#title' => t('Weight for @block block', array('@block' => $info['subject'])),
'#title' => t('Weight for @block block', array('@block' => $info['admin_label'])),
);
$form['blocks'][$entity_id]['region'] = array(
'#type' => 'select',
'#default_value' => $entity->get('region') != BLOCK_REGION_NONE ? $entity->get('region') : NULL,
'#empty_value' => BLOCK_REGION_NONE,
'#title_display' => 'invisible',
'#title' => t('Region for @block block', array('@block' => $info['subject'])),
'#title' => t('Region for @block block', array('@block' => $info['admin_label'])),
'#options' => $this->regions,
);
$links['configure'] = array(
......
......@@ -53,7 +53,7 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode, $langco
'id' => $entity->get('plugin'),
'region' => $entity->get('region'),
'module' => $entity->get('module'),
'subject' => check_plain($entity->label()),
'label' => check_plain($entity->label()),
),
);
}
......
......@@ -31,7 +31,7 @@
* task_suffix = "library",
* task_title = @Translation("Library"),
* title = @Translation("Add block"),
* title_attribute = "subject",
* title_attribute = "admin_label",
* type = MENU_LOCAL_ACTION
* )
*/
......@@ -144,7 +144,7 @@ public function row($display_plugin_id, array $display_plugin_definition) {
$plugin_definition = $this->getDefinition();
list($plugin, $theme) = explode(':', $this->getPluginId());
$row = array();
$row[] = check_plain($display_plugin_definition['subject']);
$row[] = check_plain($display_plugin_definition['admin_label']);
$row[] = array('data' => array(
'#type' => 'operations',
'#links' => array(
......
......@@ -101,7 +101,7 @@ protected function createTests() {
'plugin' => 'test_html_id',
'settings' => array(
'cache' => '1',
'subject' => t('Test block html id'),
'admin_label' => t('Test block html id'),
),
);
$this->assertIdentical($actual_properties, $expected_properties, 'The block properties are exported correctly.');
......
......@@ -5,7 +5,7 @@
* Default theme implementation to display a block.
*
* Available variables:
* - $block->subject: Block title.
* - $block->label: Block title.
* - $content: Block content.
* - $block->module: Module that generated the block.
* - $block->delta: An ID for the block, unique within each module.
......@@ -48,8 +48,8 @@
<?php endif; ?>
<?php print render($title_prefix); ?>
<?php if ($block->subject): ?>
<h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
<?php if ($block->label): ?>
<h2<?php print $title_attributes; ?>><?php print $block->label; ?></h2>
<?php endif;?>
<?php print render($title_suffix); ?>
......
......@@ -8,4 +8,4 @@ visibility: { }
plugin: test_html_id
settings:
cache: '1'
subject: 'Test block html id'
admin_label: 'Test block html id'
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "test_cache",
* subject = @Translation("Test block caching"),
* admin_label = @Translation("Test block caching"),
* module = "block_test"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "test_html_id",
* subject = @Translation("Test block html id"),
* admin_label = @Translation("Test block html id"),
* module = "block_test"
* )
*/
......
......@@ -14,7 +14,7 @@
*
* @Plugin(
* id = "test_xss_title",
* subject = "<script>alert('XSS subject');</script>",
* admin_label = "<script>alert('XSS subject');</script>",
* module = "block_test"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "book_navigation",
* subject = @Translation("Book navigation"),
* admin_label = @Translation("Book navigation"),
* module = "book"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "recent_comments",
* subject = @Translation("Recent comments"),
* admin_label = @Translation("Recent comments"),
* module = "comment"
* )
*/
......
......@@ -15,7 +15,7 @@
*
* @Plugin(
* id = "forum_active_block",
* subject = @Translation("Active forum topics"),
* admin_label = @Translation("Active forum topics"),
* module = "forum"
* )
*/
......
......@@ -15,7 +15,7 @@
*
* @Plugin(
* id = "forum_new_block",
* subject = @Translation("New forum topics"),
* admin_label = @Translation("New forum topics"),
* module = "forum"
* )
*/
......
......@@ -40,7 +40,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
$info = language_types_info();
foreach (language_types_get_configurable(FALSE) as $type) {
$this->derivatives[$type] = $base_plugin_definition;
$this->derivatives[$type]['subject'] = t('Language switcher (!type)', array('!type' => $info[$type]['name']));
$this->derivatives[$type]['admin_label'] = t('Language switcher (!type)', array('!type' => $info[$type]['name']));
$this->derivatives[$type]['cache'] = DRUPAL_NO_CACHE;
}
return $this->derivatives;
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "language_block",
* subject = @Translation("Language switcher"),
* admin_label = @Translation("Language switcher"),
* module = "language",
* derivative = "Drupal\language\Plugin\Derivative\LanguageBlock"
* )
......
......@@ -23,7 +23,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
// Provide block plugin definitions for all user-defined (custom) menus.
foreach (menu_get_menus(FALSE) as $menu => $name) {
$this->derivatives[$menu] = $base_plugin_definition;
$this->derivatives[$menu]['subject'] = $name;
$this->derivatives[$menu]['admin_label'] = $name;
$this->derivatives[$menu]['cache'] = DRUPAL_NO_CACHE;
}
return $this->derivatives;
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "menu_menu_block",
* subject = @Translation("Menu"),
* admin_label = @Translation("Menu"),
* module = "menu",
* derivative = "Drupal\menu\Plugin\Derivative\MenuBlock"
* )
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "node_recent_block",
* subject = @Translation("Recent content"),
* admin_label = @Translation("Recent content"),
* module = "node"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "node_syndicate_block",
* subject = @Translation("Syndicate"),
* admin_label = @Translation("Syndicate"),
* module = "node"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "search_form_block",
* subject = @Translation("Search form"),
* admin_label = @Translation("Search form"),
* module = "search"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "shortcuts",
* subject = @Translation("Shortcuts"),
* admin_label = @Translation("Shortcuts"),
* module = "shortcut"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "statistics_popular_block",
* subject = @Translation("Popular content"),
* admin_label = @Translation("Popular content"),
* module = "statistics"
* )
*/
......
......@@ -45,7 +45,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
$menu = "menu-$menu";
$this->derivatives[$menu] = $base_plugin_definition;
$this->derivatives[$menu]['delta'] = $menu;
$this->derivatives[$menu]['subject'] = $name;
$this->derivatives[$menu]['admin_label'] = $name;
$this->derivatives[$menu]['cache'] = DRUPAL_NO_CACHE;
}
return $this->derivatives;
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "system_help_block",
* subject = @Translation("System Help"),
* admin_label = @Translation("System Help"),
* module = "system"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "system_main_block",
* subject = @Translation("Main page content"),
* admin_label = @Translation("Main page content"),
* module = "system"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "system_menu_block",
* subject = @Translation("System Menu"),
* admin_label = @Translation("System Menu"),
* module = "system",
* derivative = "Drupal\system\Plugin\Derivative\SystemMenuBlock"
* )
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "system_powered_by_block",
* subject = @Translation("Powered by Drupal"),
* admin_label = @Translation("Powered by Drupal"),
* module = "system"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "user_login_block",
* subject = @Translation("User login"),
* admin_label = @Translation("User login"),
* module = "user"
* )
*/
......
......@@ -16,7 +16,7 @@
*
* @Plugin(
* id = "user_new_block",
* subject = @Translation("Who's new"),
* admin_label = @Translation("Who's new"),
* module = "user"
* )
*/
......
......@@ -19,7 +19,7 @@
*
* @Plugin(
* id = "user_online_block",
* subject = @Translation("Who's online"),
* admin_label = @Translation("Who's online"),
* module = "user"
* )
*/
......
......@@ -61,7 +61,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
}
}
$this->derivatives[$delta] = array(
'subject' => $desc,
'admin_label' => $desc,
'cache' => $display->getCacheType()
);
$this->derivatives[$delta] += $base_plugin_definition;
......
......@@ -53,7 +53,7 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
$delta = $view->id() . '-' . $display->display['id'];
$desc = t('Exposed form: @view-@display_id', array('@view' => $view->id(), '@display_id' => $display->display['id']));
$this->derivatives[$delta] = array(
'subject' => $desc,
'admin_label' => $desc,
'cache' => DRUPAL_NO_CACHE,
);
$this->derivatives[$delta] += $base_plugin_definition;
......
......@@ -18,7 +18,7 @@
*
* @Plugin(
* id = "views_block",
* subject = @Translation("Views Block"),
* admin_label = @Translation("Views Block"),
* module = "views",
* derivative = "Drupal\views\Plugin\Derivative\ViewsBlock"
* )
......
......@@ -15,7 +15,7 @@
*
* @Plugin(
* id = "views_exposed_filter_block",
* subject = @Translation("Views Exposed Filter Block"),
* admin_label = @Translation("Views Exposed Filter Block"),
* module = "views",
* derivative = "Drupal\views\Plugin\Derivative\ViewsExposedFilterBlock"
* )
......
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