Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option in og_context_plugin_argument_default_group_context.inc to accompany the permission rewrite in og_context(). #131

Merged
merged 4 commits into from Jul 11, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to define it also in option_definition

'#type' => 'select',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a checkbox

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solved.

'#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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and then you can do group = og_context($this->options['group_type'], NULL, NULL, $this->options['check_access'])

if ($group = og_context($this->options['group_type'], NULL, NULL, $check_access)) {
return $group['gid'];
}
return FALSE;
Expand Down