diff --git a/core/modules/outside_in/outside_in.module b/core/modules/outside_in/outside_in.module index 5b9a79a..28f9107 100644 --- a/core/modules/outside_in/outside_in.module +++ b/core/modules/outside_in/outside_in.module @@ -55,9 +55,9 @@ function outside_in_block_view_alter(array &$build) { $build['#contextual_links']['outside_in'] = [ 'route_parameters' => [], ]; - if (!\Drupal::service('outside_in.manager')->isBlockEditable($build['#plugin_id']) && isset($build['#contextual_links']['block'])) { + if (!_outside_in_is_block_editable($build['#plugin_id']) && isset($build['#contextual_links']['block'])) { // If this block should not be editable set an attribute which will be used - // to remove the link on the client-side. + // to remove the link on the client side. // The individual links are not available here to remove. // @see outside_in.js $build['#attributes']['data-outside-in-exclude'] = TRUE; @@ -103,7 +103,7 @@ function outside_in_preprocess_block(&$variables) { $variables['#cache']['contexts'][] = 'outside_in_is_applied'; /** @var \Drupal\outside_in\OutsideInManagerInterface $outside_in_manager */ $outside_in_manager = \Drupal::service('outside_in.manager'); - if ($outside_in_manager->isBlockEditable($variables['plugin_id']) && $outside_in_manager->isApplicable()) { + if (_outside_in_is_block_editable($variables['plugin_id']) && $outside_in_manager->isApplicable()) { // Add class and attributes to all blocks to allow Javascript to target. $variables['attributes']['class'][] = 'outside-in-editable'; $variables['attributes']['data-drupal-outsidein'] = 'editable'; @@ -164,3 +164,18 @@ function outside_in_css_alter(&$css, AttachedAssetsInterface $assets) { $css[$path]['group'] = 200; } } + +/** + * Checks whether a block is editable by this module. + * + * @param string $plugin_id + * The plugin ID for the block to check. + * + * @return bool + * TRUE if the block should have the "Quick Edit" link provided by this + * module. + */ +function _outside_in_is_block_editable($plugin_id) { + $non_editable_blocks = ['page_title_block', 'system_main_block']; + return !in_array($plugin_id, $non_editable_blocks, TRUE); +} diff --git a/core/modules/outside_in/src/OutsideInManager.php b/core/modules/outside_in/src/OutsideInManager.php index 26bda75..666a938 100644 --- a/core/modules/outside_in/src/OutsideInManager.php +++ b/core/modules/outside_in/src/OutsideInManager.php @@ -63,12 +63,4 @@ public function isApplicable() { return $this->account->hasPermission('administer blocks') && !$is_admin_route && !$is_admin_demo_route; } - /** - * {@inheritdoc} - */ - public function isBlockEditable($plugin_id) { - $non_editable_blocks = ['page_title_block', 'system_main_block']; - return !in_array($plugin_id, $non_editable_blocks, TRUE); - } - } diff --git a/core/modules/outside_in/src/OutsideInManagerInterface.php b/core/modules/outside_in/src/OutsideInManagerInterface.php index 054074e..684adb3 100644 --- a/core/modules/outside_in/src/OutsideInManagerInterface.php +++ b/core/modules/outside_in/src/OutsideInManagerInterface.php @@ -15,16 +15,4 @@ */ public function isApplicable(); - /** - * Checks whether a block is editable by this module. - * - * @param string $plugin_id - * The plugin ID for the block to check. - * - * @return bool - * TRUE if the block should have the "Quick Edit" link provided by this - * module. - */ - public function isBlockEditable($plugin_id); - }