-
Notifications
You must be signed in to change notification settings - Fork 132
254 Default argument membership #564
254 Default argument membership #564
Conversation
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
/** | ||
* Default argument plugin to provide the group memberships from the current context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Default argument plugin to provide the group memberships from the current context. | |
* Default argument plugin to provide the group memberships from the current | |
* context. |
* The OG context provider. | ||
* @param \Drupal\og\MembershipManagerInterface $og_membership | ||
* The OG membership manager. | ||
* @param \Drupal\Core\Session\AccountInterface $og_user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param \Drupal\Core\Session\AccountInterface $og_user | |
* @param \Drupal\Core\Session\AccountInterface $user |
* @param \Drupal\Core\Session\AccountInterface $og_user | ||
* The user to be evaluated. | ||
*/ | ||
public function __construct(array $configuration, $plugin_id, $plugin_definition, ContextProviderInterface $og_context, MembershipManagerInterface $og_membership, AccountInterface $og_user) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function __construct(array $configuration, $plugin_id, $plugin_definition, ContextProviderInterface $og_context, MembershipManagerInterface $og_membership, AccountInterface $og_user) { | |
public function __construct(array $configuration, $plugin_id, $plugin_definition, ContextProviderInterface $og_context, MembershipManagerInterface $og_membership, AccountInterface $user) { |
|
||
$this->ogContext = $og_context; | ||
$this->ogMembership = $og_membership; | ||
$this->ogUser = $og_user; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->ogUser = $og_user; | |
$this->ogUser = $user; |
*/ | ||
public function getCacheContexts() { | ||
// This cache context is the best thing we have right now. | ||
// og_role takes in consideration the user memberships and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// og_role takes in consideration the user memberships and | |
// og_role takes in consideration the user memberships and |
public function getCacheContexts() { | ||
// This cache context is the best thing we have right now. | ||
// og_role takes in consideration the user memberships and | ||
// the roles held in the corresponding groups, and while it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// the roles held in the corresponding groups, and while it | |
// the roles held in the corresponding groups, and while it |
// This cache context is the best thing we have right now. | ||
// og_role takes in consideration the user memberships and | ||
// the roles held in the corresponding groups, and while it | ||
// is one level too granular, i.e. the context will be more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// is one level too granular, i.e. the context will be more | |
// is one level too granular, i.e. the context will be more |
* An array of groups, or an empty array if no group is found. | ||
*/ | ||
protected function getCurrentUserGroupIds($entity_type = 'node') { | ||
$groups = $this->ogMembership->getUserGroupIds($this->ogUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$groups = $this->ogMembership->getUserGroupIds($this->ogUser); | |
$groups = $this->ogMembership->getUserGroupIds($this->ogUser->id()); |
Merging tombola:default-argument-membership into gizra/og