diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc index 52f517c..2653266 100644 --- a/core/modules/comment/comment.views.inc +++ b/core/modules/comment/comment.views.inc @@ -248,6 +248,11 @@ function comment_views_data() { 'label' => t('Approved comment status'), 'type' => 'yes-no', ), + 'argument' => array( + 'id' => 'boolean', + 'on_label'=>'Approved', + 'off_label'=>'Not Approved' + ), 'sort' => array( 'id' => 'standard', ), diff --git a/core/modules/forum/forum.views.inc b/core/modules/forum/forum.views.inc index fa7174f..bfa121f 100644 --- a/core/modules/forum/forum.views.inc +++ b/core/modules/forum/forum.views.inc @@ -116,6 +116,11 @@ function forum_views_data() { 'label' => t('Sticky'), 'type' => 'yes-no', ), + 'argument' => array( + 'id' => 'boolean', + 'on_label'=>'Sticky', + 'off_label'=>'Not Sticky' + ), 'sort' => array( 'id' => 'standard', 'help' => t('Whether or not the content is sticky. To list sticky content first, set this to descending.'), diff --git a/core/modules/node/node.views.inc b/core/modules/node/node.views.inc index 9243adf..b8e7c02 100644 --- a/core/modules/node/node.views.inc +++ b/core/modules/node/node.views.inc @@ -161,6 +161,11 @@ function node_views_data() { // Use status = 1 instead of status <> 0 in WHERE statement. 'use_equal' => TRUE, ), + 'argument' => array( + 'id' => 'boolean', + 'on_label'=>'Published', + 'off_label'=>'Not Published' + ), 'sort' => array( 'id' => 'standard', ), @@ -190,6 +195,11 @@ function node_views_data() { 'label' => t('Promoted to front page status'), 'type' => 'yes-no', ), + 'argument' => array( + 'id' => 'boolean', + 'on_label'=>'On Front Page', + 'off_label'=>'Not on Front Page' + ), 'sort' => array( 'id' => 'standard', ), @@ -209,6 +219,11 @@ function node_views_data() { 'label' => t('Sticky status'), 'type' => 'yes-no', ), + 'argument' => array( + 'id' => 'boolean', + 'on_label'=>'Sticky', + 'off_label'=>'Not Sticky' + ), 'sort' => array( 'id' => 'standard', 'help' => t('Whether or not the content is sticky. To list sticky content first, set this to descending.'), @@ -558,6 +573,11 @@ function node_views_data() { // Use status = 1 instead of status <> 0 in WHERE statement. 'use_equal' => TRUE, ), + 'argument' => array( + 'id' => 'boolean', + 'on_label'=>'Published', + 'off_label'=>'Not Published' + ), 'sort' => array( 'id' => 'standard', ), diff --git a/core/modules/tracker/tracker.views.inc b/core/modules/tracker/tracker.views.inc index 14c125e..2e231b5 100644 --- a/core/modules/tracker/tracker.views.inc +++ b/core/modules/tracker/tracker.views.inc @@ -51,6 +51,11 @@ function tracker_views_data() { 'accept null' => TRUE, 'use_equal' => TRUE, ), + 'argument' => array( + 'id' => 'boolean', + 'on_label'=>'Published', + 'off_label'=>'Not Published' + ), 'sort' => array( 'id' => 'standard', ), @@ -132,6 +137,11 @@ function tracker_views_data() { 'accept null' => TRUE, 'use_equal' => TRUE, ), + 'argument' => array( + 'id' => 'boolean', + 'on_label'=>'Published', + 'off_label'=>'Not Published' + ), 'sort' => array( 'id' => 'standard', ), diff --git a/core/modules/user/user.views.inc b/core/modules/user/user.views.inc index b2e2773..cc1ac98 100644 --- a/core/modules/user/user.views.inc +++ b/core/modules/user/user.views.inc @@ -262,6 +262,11 @@ function user_views_data() { 'label' => t('Active'), 'type' => 'yes-no', ), + 'argument' => array( + 'id' => 'boolean', + 'on_label'=>'Active', + 'off_label'=>'Blocked' + ), 'sort' => array( 'id' => 'standard', ), diff --git a/core/modules/views/src/Plugin/views/argument/Boolean.php b/core/modules/views/src/Plugin/views/argument/Boolean.php new file mode 100644 index 0000000..566dfb8 --- /dev/null +++ b/core/modules/views/src/Plugin/views/argument/Boolean.php @@ -0,0 +1,65 @@ +{$this->name_alias})?$this->options['on_label']:$this->options['off_label']; + } + + function title() { + return $this->argument?$this->options['on_label']:$this->options['off_label']; + } + + function defineOptions() { + $options = parent::defineOptions(); + + $options['on_label'] = array('default' => $this->definition['on_label'], 'bool' => false); + $options['off_label'] = array('default' => $this->definition['off_label'], 'bool' => false); + + return $options; + } + + function buildOptionsForm(&$form, &$form_state) { + parent::buildOptionsForm($form, $form_state); + + // allow + for or, , for and + $form['on_label'] = array( + '#type' => 'textfield', + '#title' => t('Text to use for On value'), + '#description' => t('Text to show instead of %on is displayed in summary lists', array('%on'=>$this->options['on_label'])), + '#default_value' => $this->options['on_label'], + '#fieldset' => 'more', + ); + $form['off_label'] = array( + '#type' => 'textfield', + '#title' => t('Text to use for Off value'), + '#description' => t('Text to show when the word %off is displayed in summary lists', array('%off'=>$this->options['off_label'])), + '#default_value' => $this->options['off_label'], + '#fieldset' => 'more', + ); + } +} \ No newline at end of file