/**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $user = User::load($this->currentUser()->id());
     $membership = Og::getMembership($this->collection, $user);
     $membership->delete();
     drupal_set_message($this->t('You are no longer a member of %collection.', ['%collection' => $this->collection->getName()]));
     // @todo: This is a temporary workaround for the lack of og cache
     // contexts/tags. Remove this when Og provides proper cache context.
     // @see: https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-2628
     Cache::invalidateTags(['user.roles']);
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
Ejemplo n.º 2
0
 /**
  * Route title callback.
  *
  * @param \Drupal\rdf_entity\RdfInterface $rdf_entity
  *   The rdf entity.
  *
  * @return array
  *   The rdf entity label as a render array.
  */
 public function rdfTitle(RdfInterface $rdf_entity)
 {
     return ['#markup' => $rdf_entity->getName(), '#allowed_tags' => Xss::getHtmlTagList()];
 }