Verified Commit 9fc95e06 authored by Dave Long's avatar Dave Long
Browse files

task: #3573879 Mark layout_builder_expose_all_field_blocks obsolete, uninstall...

task: #3573879 Mark layout_builder_expose_all_field_blocks obsolete, uninstall it and remove integration code

By: smustgrave
By: catch
By: ishani patel
By: danielveza
By: gábor hojtsy
parent 326c357e
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -49,3 +49,12 @@ function layout_builder_schema(): array {
function layout_builder_update_last_removed(): int {
  return 8602;
}

/**
 * Uninstall the layout_builder_expose_all_field_blocks module.
 */
function layout_builder_update_12001(): void {
  if (\Drupal::moduleHandler()->moduleExists('layout_builder_expose_all_field_blocks')) {
    \Drupal::service('module_installer')->uninstall(['layout_builder_expose_all_field_blocks']);
  }
}
+1 −1
Original line number Diff line number Diff line
@@ -5,5 +5,5 @@ package: Core
version: VERSION
dependencies:
  - drupal:layout_builder
lifecycle: deprecated
lifecycle: obsolete
lifecycle_link: "https://www.drupal.org/node/3223395#s-layout-builder-expose-all-field-blocks"
+0 −36
Original line number Diff line number Diff line
<?php

namespace Drupal\layout_builder_expose_all_field_blocks\Hook;

use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Hook\Attribute\Hook;
use Drupal\Core\StringTranslation\StringTranslationTrait;

/**
 * Hook implementations for layout_builder_expose_all_field_blocks.
 */
class LayoutBuilderExposeAllFieldBlocksHooks {

  use StringTranslationTrait;

  /**
   * Implements hook_help().
   */
  #[Hook('help')]
  public function help($route_name, RouteMatchInterface $route_match): ?string {
    switch ($route_name) {
      case 'help.page.layout_builder_expose_all_field_blocks':
        $output = '<h2>' . $this->t('About') . '</h2>';
        $output .= '<p>' . $this->t('The Layout Builder Expose All Field Blocks module is a Feature Flag module which exposes all fields on all bundles as field blocks for use in Layout Builder.') . '</p>';
        $output .= '<p>' . $this->t('Using this feature can significantly reduce the performance of medium to large sites due to the number of Field Block plugins that will be created. It is recommended to uninstall this module, if possible.') . '</p>';
        $output .= '<p>' . $this->t('While it is recommended to uninstall this module, doing so may remove blocks that are being used in your site.') . '</p>';
        $output .= '<p>' . $this->t("For example, if Layout Builder is enabled on a Node bundle (Content type), and that bundle's display is using field blocks from the User entity (e.g. the Author's name), but Layout Builder is not enabled for the User bundle, then that field block would no longer exist after uninstalling this module.") . '</p>';
        $output .= '<p>' . $this->t('For more information, see the <a href=":href">online documentation for the Layout Builder Expose All Field Blocks module</a>.', [
          ':href' => 'https://www.drupal.org/node/3223395#s-layout-builder-expose-all-field-blocks',
        ]) . '</p>';
        return $output;
    }
    return NULL;
  }

}
+0 −18
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace Drupal\Tests\layout_builder_expose_all_field_blocks\Functional;

use Drupal\Tests\system\Functional\Module\GenericModuleTestBase;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;

/**
 * Generic module test for layout_builder_expose_all_field_blocks.
 */
#[Group('layout_builder_expose_all_field_blocks')]
#[IgnoreDeprecations]
#[RunTestsInSeparateProcesses]
class GenericTest extends GenericModuleTestBase {}
+3 −5
Original line number Diff line number Diff line
@@ -178,11 +178,9 @@ public function preSave(EntityStorageInterface $storage) {
   */
  public function save(): int {
    $return = parent::save();
    if (!\Drupal::moduleHandler()->moduleExists('layout_builder_expose_all_field_blocks')) {
    // Invalidate the block cache in order to regenerate field block
    // definitions.
    \Drupal::service('plugin.manager.block')->clearCachedDefinitions();
    }
    return $return;
  }

Loading