Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Isaicp 2237 #28

Merged
merged 84 commits into from
Mar 29, 2016
Merged

Isaicp 2237 #28

merged 84 commits into from
Mar 29, 2016

Conversation

idimopoulos
Copy link
Contributor

No description provided.

if ($member->getEntityTypeId() == 'user') {
$membership->setUser($member->id());
}
$membership->save();
Copy link
Contributor

Choose a reason for hiding this comment

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

This only works for users. This has recently changed. All entity types other than users now use field storage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes but this method does that exactly. Checks a user membership.
Also it is defined as such: @given (the following )user memberships:

*/
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->currentRouteMatch = \Drupal::routeMatch();
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't inject the routematcher in a block and do direct checks on the route. That creates a hard coupling between the block and the route. If we ever change the route then this doesn't work any more.

Drupal has the concept of Contexts for this. We already have a context to retrieve the collection from the route: \Drupal\collection\ContextProvider\CollectionRouteContext. Let's use this instead.

…ted. Custom pages are not depending on memberships at the moment.
…nodes. Otherwise they cannot create published nodes.
@idimopoulos idimopoulos merged commit eb5536b into develop Mar 29, 2016
@idimopoulos idimopoulos deleted the ISAICP-2237 branch March 29, 2016 14:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants