Loading frontend_editing.module +5 −2 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ * Functions and hooks for the frontend_editing module. */ use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityInterface; Loading @@ -23,6 +24,8 @@ function frontend_editing_entity_view_alter(&$build, EntityInterface $entity, En } $config = \Drupal::configFactory()->get('frontend_editing.settings'); $cacheable_metadata = new CacheableMetadata(); $cacheable_metadata->addCacheableDependency($config); $supported_entity_types = $config->get('entity_types'); // If a value is 0 (for disabled) a search will evaluate to TRUE, e.g. // "'key' == 0" evaluates to TRUE, therefore we need to perform strict search. Loading @@ -31,11 +34,11 @@ function frontend_editing_entity_view_alter(&$build, EntityInterface $entity, En } // Only do this, if user has access to frontend editing. $build['#cache']['contexts'][] = 'user.permissions'; $cacheable_metadata->addCacheContexts(['user.permissions']); if (!\Drupal::currentUser()->hasPermission('access frontend editing') || ($entity instanceof RevisionableInterface && !$entity->isLatestRevision()) || !$entity->access('update')) { return; } $cacheable_metadata->applyTo($build); // Add the editing url as a data attribute. $url = Url::fromRoute('frontend_editing.form', [ 'type' => $entity->getEntityTypeId(), Loading src/Form/SettingsForm.php +0 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,6 @@ class SettingsForm extends ConfigFormBase { ->set('sidebar_width', $form_state->getValue('sidebar_width')) ->set('full_width', $form_state->getValue('full_width')) ->save(); drupal_flush_all_caches(); parent::submitForm($form, $form_state); } Loading Loading
frontend_editing.module +5 −2 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ * Functions and hooks for the frontend_editing module. */ use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityInterface; Loading @@ -23,6 +24,8 @@ function frontend_editing_entity_view_alter(&$build, EntityInterface $entity, En } $config = \Drupal::configFactory()->get('frontend_editing.settings'); $cacheable_metadata = new CacheableMetadata(); $cacheable_metadata->addCacheableDependency($config); $supported_entity_types = $config->get('entity_types'); // If a value is 0 (for disabled) a search will evaluate to TRUE, e.g. // "'key' == 0" evaluates to TRUE, therefore we need to perform strict search. Loading @@ -31,11 +34,11 @@ function frontend_editing_entity_view_alter(&$build, EntityInterface $entity, En } // Only do this, if user has access to frontend editing. $build['#cache']['contexts'][] = 'user.permissions'; $cacheable_metadata->addCacheContexts(['user.permissions']); if (!\Drupal::currentUser()->hasPermission('access frontend editing') || ($entity instanceof RevisionableInterface && !$entity->isLatestRevision()) || !$entity->access('update')) { return; } $cacheable_metadata->applyTo($build); // Add the editing url as a data attribute. $url = Url::fromRoute('frontend_editing.form', [ 'type' => $entity->getEntityTypeId(), Loading
src/Form/SettingsForm.php +0 −1 Original line number Diff line number Diff line Loading @@ -118,7 +118,6 @@ class SettingsForm extends ConfigFormBase { ->set('sidebar_width', $form_state->getValue('sidebar_width')) ->set('full_width', $form_state->getValue('full_width')) ->save(); drupal_flush_all_caches(); parent::submitForm($form, $form_state); } Loading