Issue #2732091 by damiankloip: Boolean exposed filter value widget just shows 'True' label

8.2.x
Nathaniel Catchpole 2016-06-14 16:28:38 +01:00
parent 22c915f33f
commit a03a23b21b
3 changed files with 10 additions and 1 deletions

View File

@ -86,7 +86,7 @@ class ViewsHandlerManager extends DefaultPluginManager implements FallbackPlugin
if (isset($data[$field][$this->handlerType])) { if (isset($data[$field][$this->handlerType])) {
$definition = $data[$field][$this->handlerType]; $definition = $data[$field][$this->handlerType];
foreach (array('group', 'title', 'title short', 'help', 'real field', 'real table', 'entity type', 'entity field') as $key) { foreach (array('group', 'title', 'title short', 'label', 'help', 'real field', 'real table', 'entity type', 'entity field') as $key) {
if (!isset($definition[$key])) { if (!isset($definition[$key])) {
// First check the field level. // First check the field level.
if (!empty($data[$field][$key])) { if (!empty($data[$field][$key])) {

View File

@ -93,9 +93,14 @@ class BooleanOperator extends FilterPluginBase {
parent::init($view, $display, $options); parent::init($view, $display, $options);
$this->value_value = $this->t('True'); $this->value_value = $this->t('True');
if (isset($this->definition['label'])) { if (isset($this->definition['label'])) {
$this->value_value = $this->definition['label']; $this->value_value = $this->definition['label'];
} }
elseif (isset($this->definition['title'])) {
$this->value_value = $this->definition['title'];
}
if (isset($this->definition['accept null'])) { if (isset($this->definition['accept null'])) {
$this->accept_null = (bool) $this->definition['accept null']; $this->accept_null = (bool) $this->definition['accept null'];
} }

View File

@ -23,6 +23,10 @@ class FilterBooleanWebTest extends UITestBase {
public function testFilterBooleanUI() { public function testFilterBooleanUI() {
$this->drupalPostForm('admin/structure/views/nojs/add-handler/test_view/default/filter', array('name[views_test_data.status]' => TRUE), t('Add and configure @handler', array('@handler' => t('filter criteria')))); $this->drupalPostForm('admin/structure/views/nojs/add-handler/test_view/default/filter', array('name[views_test_data.status]' => TRUE), t('Add and configure @handler', array('@handler' => t('filter criteria'))));
// Check the field widget label. 'title' should be used as a fallback.
$result = $this->cssSelect('#edit-options-value--wrapper legend span');
$this->assertEqual((string) $result[0], 'Status');
$this->drupalPostForm(NULL, array(), t('Expose filter')); $this->drupalPostForm(NULL, array(), t('Expose filter'));
$this->drupalPostForm(NULL, array(), t('Grouped filters')); $this->drupalPostForm(NULL, array(), t('Grouped filters'));