Skip to content
Snippets Groups Projects
Commit 7c5e7f60 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2020111 by damiankloip, a_c_m, dawehner, tim.plunkett: Allow the "With...

Issue #2020111 by damiankloip, a_c_m, dawehner, tim.plunkett: Allow the "With selection" label on bulk operation to be configured.
parent 744309f9
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
views.field.bulk_form:
type: views_field
label: 'Bulk form'
mapping:
action_title:
type: label
label: 'Action title'
......@@ -113,6 +113,21 @@ public function testBulkForm() {
$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]);
}
}
......@@ -25,6 +25,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.
*
......@@ -116,7 +140,7 @@ public function views_form(&$form, &$form_state) {
);
$form['header'][$this->options['id']]['action'] = array(
'#type' => 'select',
'#title' => t('With selection'),
'#title' => $this->options['action_title'],
'#options' => $this->getBulkOptions(),
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment