From 49821073482c197c162f4703267e5a18b3fbf951 Mon Sep 17 00:00:00 2001 From: Ales Rebec Date: Thu, 23 Jun 2016 11:30:15 +0200 Subject: [PATCH 1/3] Issue #121: Added option in og_context_plugin_argument_default_group_context.inc to accompany the permission rewrite in og_context(). --- ...g_context_plugin_argument_default_group_context.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc b/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc index bf0682561..c65a80ab8 100644 --- a/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc +++ b/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc @@ -32,13 +32,21 @@ class og_context_plugin_argument_default_group_context extends views_plugin_argu '#default_value' => $this->options['group_type'], '#description' => t('Determine what entity type that group should be of.') ); + $form['check_access'] = array( + '#type' => 'select', + '#options' => array(t('No'), t('Yes')), + '#title' => t('Check access'), + '#default_value' => $this->options['check_access'], + '#description' => t('Determines if access to the group should be done. Defaults to "Yes".') + ); } /** * Return the group context argument. */ function get_argument() { - if ($group = og_context($this->options['group_type'])) { + $check_access = (isset($this->options['check_access']) && $this->options['check_access'] == 0) ? FALSE : TRUE; + if ($group = og_context($this->options['group_type'], NULL, NULL, $check_access)) { return $group['gid']; } return FALSE; From 0e33e3974332d235d0f27194cbd40ef8c48f3d7a Mon Sep 17 00:00:00 2001 From: Ales Rebec Date: Thu, 23 Jun 2016 12:08:26 +0200 Subject: [PATCH 2/3] Issue #121: Added option_definition for ['check_access']. --- .../og_context_plugin_argument_default_group_context.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc b/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc index c65a80ab8..5a21744a6 100644 --- a/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc +++ b/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc @@ -17,6 +17,7 @@ class og_context_plugin_argument_default_group_context extends views_plugin_argu function option_definition() { $options = parent::option_definition(); $options['group_type'] = array('default' => 'node'); + $options['check_access'] = array('default' => TRUE); return $options; } @@ -45,8 +46,7 @@ class og_context_plugin_argument_default_group_context extends views_plugin_argu * Return the group context argument. */ function get_argument() { - $check_access = (isset($this->options['check_access']) && $this->options['check_access'] == 0) ? FALSE : TRUE; - if ($group = og_context($this->options['group_type'], NULL, NULL, $check_access)) { + if ($group = og_context($this->options['group_type'], NULL, NULL, $this->options['check_access'])) { return $group['gid']; } return FALSE; From 16be973da6ace0ec942ba7a15b0a2a0baddecb61 Mon Sep 17 00:00:00 2001 From: Ales Rebec Date: Thu, 23 Jun 2016 12:55:21 +0200 Subject: [PATCH 3/3] Issue #121: Changed form element type for check_access from select to checkbox and changed description to match the change. --- .../og_context_plugin_argument_default_group_context.inc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc b/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc index 5a21744a6..1675e59ef 100644 --- a/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc +++ b/og_context/includes/views/handlers/og_context_plugin_argument_default_group_context.inc @@ -17,7 +17,7 @@ class og_context_plugin_argument_default_group_context extends views_plugin_argu function option_definition() { $options = parent::option_definition(); $options['group_type'] = array('default' => 'node'); - $options['check_access'] = array('default' => TRUE); + $options['check_access'] = array('default' => TRUE, 'bool' => TRUE); return $options; } @@ -34,11 +34,10 @@ class og_context_plugin_argument_default_group_context extends views_plugin_argu '#description' => t('Determine what entity type that group should be of.') ); $form['check_access'] = array( - '#type' => 'select', - '#options' => array(t('No'), t('Yes')), + '#type' => 'checkbox', '#title' => t('Check access'), + '#description' => t('Determines if access to the group should be done. Defaults to "Checked".'), '#default_value' => $this->options['check_access'], - '#description' => t('Determines if access to the group should be done. Defaults to "Yes".') ); }