summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2013-11-14 08:16:16 (GMT)
committerwebchick2013-11-14 08:16:16 (GMT)
commit7c5e7f60e5407840ea0587cd959340d54607116e (patch)
tree147c25a0d7c9abb84a4c46d8d1142586fb799bc1
parent744309f9f2d885559b45b06885c77352b506b2a9 (diff)
Issue #2020111 by damiankloip, a_c_m, dawehner, tim.plunkett: Allow the "With selection" label on bulk operation to be configured.
-rw-r--r--core/modules/action/config/schema/views.field.schema.yml7
-rw-r--r--core/modules/action/lib/Drupal/action/Tests/BulkFormTest.php15
-rw-r--r--core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php26
3 files changed, 47 insertions, 1 deletions
diff --git a/core/modules/action/config/schema/views.field.schema.yml b/core/modules/action/config/schema/views.field.schema.yml
new file mode 100644
index 0000000..cd19eee
--- /dev/null
+++ b/core/modules/action/config/schema/views.field.schema.yml
@@ -0,0 +1,7 @@
+views.field.bulk_form:
+ type: views_field
+ label: 'Bulk form'
+ mapping:
+ action_title:
+ type: label
+ label: 'Action title'
diff --git a/core/modules/action/lib/Drupal/action/Tests/BulkFormTest.php b/core/modules/action/lib/Drupal/action/Tests/BulkFormTest.php
index 86edb19..dcce0c7 100644
--- a/core/modules/action/lib/Drupal/action/Tests/BulkFormTest.php
+++ b/core/modules/action/lib/Drupal/action/Tests/BulkFormTest.php
@@ -113,6 +113,21 @@ class BulkFormTest extends WebTestBase {
$this->drupalGet('test_bulk_form');
$this->assertNoOption('edit-action', 'node_make_sticky_action');
$this->assertNoOption('edit-action', 'node_make_unsticky_action');
+
+ // Check the default title.
+ $this->drupalGet('test_bulk_form');
+ $result = $this->xpath('//label[@for="edit-action"]');
+ $this->assertEqual('With selection', (string) $result[0]);
+
+ // Setup up a different bulk form title.
+ $view = views_get_view('test_bulk_form');
+ $display = &$view->storage->getDisplay('default');
+ $display['display_options']['fields']['action_bulk_form']['action_title'] = 'Test title';
+ $view->save();
+
+ $this->drupalGet('test_bulk_form');
+ $result = $this->xpath('//label[@for="edit-action"]');
+ $this->assertEqual('Test title', (string) $result[0]);
}
}
diff --git a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php
index 1f53f9f..a14e059 100644
--- a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php
+++ b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkFormBase.php
@@ -26,6 +26,30 @@ abstract class BulkFormBase extends FieldPluginBase {
protected $actions = array();
/**
+ * {@inheritdoc }
+ */
+ protected function defineOptions() {
+ $options = parent::defineOptions();
+ $options['action_title'] = array('default' => 'With selection', 'translatable' => TRUE);
+ return $options;
+ }
+
+ /**
+ * {@inheritdoc }
+ */
+ public function buildOptionsForm(&$form, &$form_state) {
+ $form['action_title'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Action title'),
+ '#default_value' => $this->options['action_title'],
+ '#description' => t('The title shown above the actions dropdown.'),
+ );
+
+ parent::buildOptionsForm($form, $form_state);
+ }
+
+
+ /**
* Constructs a new BulkForm object.
*
* @param array $configuration
@@ -116,7 +140,7 @@ abstract class BulkFormBase extends FieldPluginBase {
);
$form['header'][$this->options['id']]['action'] = array(
'#type' => 'select',
- '#title' => t('With selection'),
+ '#title' => $this->options['action_title'],
'#options' => $this->getBulkOptions(),
);