Issue #2020111 by damiankloip, a_c_m, dawehner, tim.plunkett: Allow the "With selection" label on bulk operation to be configured.

8.0.x
webchick 2013-11-14 00:16:16 -08:00
parent 744309f9f2
commit 7c5e7f60e5
3 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,7 @@
views.field.bulk_form:
type: views_field
label: 'Bulk form'
mapping:
action_title:
type: label
label: 'Action title'

View File

@ -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]);
}
}

View File

@ -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 @@ 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(),
);