Issue #3261244 by andypost, longwave: Remove deprecated layout_builder module functions
parent
13f6bba1ea
commit
39726b6ace
|
@ -30,26 +30,6 @@ trait LayoutBuilderContextTrait {
|
|||
return $this->contextRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides all available contexts, both global and section_storage-specific.
|
||||
*
|
||||
* @param \Drupal\layout_builder\SectionStorageInterface $section_storage
|
||||
* The section storage.
|
||||
*
|
||||
* @return \Drupal\Core\Plugin\Context\ContextInterface[]
|
||||
* The array of context objects.
|
||||
*
|
||||
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
|
||||
* \Drupal\layout_builder\Context\LayoutBuilderContextTrait::getPopulatedContexts()
|
||||
* instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/3195121
|
||||
*/
|
||||
protected function getAvailableContexts(SectionStorageInterface $section_storage) {
|
||||
@trigger_error('\Drupal\layout_builder\Context\LayoutBuilderContextTrait::getAvailableContexts() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\layout_builder\Context\LayoutBuilderContextTrait::getPopulatedContexts() instead. See https://www.drupal.org/node/3195121', E_USER_DEPRECATED);
|
||||
return self::getPopulatedContexts($section_storage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all populated contexts, both global and section-storage-specific.
|
||||
*
|
||||
|
|
|
@ -48,22 +48,10 @@ class LayoutBuilder extends RenderElement implements ContainerFactoryPluginInter
|
|||
* The plugin implementation definition.
|
||||
* @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher
|
||||
* The event dispatcher service.
|
||||
* @param \Drupal\Core\Messenger\MessengerInterface|null $messenger
|
||||
* The messenger service. This is no longer used and will be removed in
|
||||
* drupal:10.0.0.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, $event_dispatcher, $messenger = NULL) {
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, EventDispatcherInterface $event_dispatcher) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
|
||||
if (!($event_dispatcher instanceof EventDispatcherInterface)) {
|
||||
@trigger_error('The event_dispatcher service should be passed to LayoutBuilder::__construct() instead of the layout_builder.tempstore_repository service since 9.1.0. This will be required in Drupal 10.0.0. See https://www.drupal.org/node/3152690', E_USER_DEPRECATED);
|
||||
$event_dispatcher = \Drupal::service('event_dispatcher');
|
||||
}
|
||||
$this->eventDispatcher = $event_dispatcher;
|
||||
|
||||
if ($messenger) {
|
||||
@trigger_error('Calling LayoutBuilder::__construct() with the $messenger argument is deprecated in drupal:9.1.0 and will be removed in drupal:10.0.0. See https://www.drupal.org/node/3152690', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\layout_builder\SectionStorage;
|
||||
|
||||
@trigger_error(__NAMESPACE__ . '\SectionStorageTrait is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\layout_builder\SectionListTrait instead. See https://www.drupal.org/node/3091432', E_USER_DEPRECATED);
|
||||
|
||||
use Drupal\layout_builder\SectionListTrait;
|
||||
|
||||
/**
|
||||
* Provides a trait for storing sections on an object.
|
||||
*
|
||||
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
|
||||
* \Drupal\layout_builder\SectionListTrait instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/3091432
|
||||
*/
|
||||
trait SectionStorageTrait {
|
||||
|
||||
use SectionListTrait;
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\layout_builder\Kernel;
|
||||
|
||||
use Drupal\Core\Messenger\MessengerInterface;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\layout_builder\Element\LayoutBuilder;
|
||||
use Drupal\layout_builder\LayoutTempstoreRepositoryInterface;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
/**
|
||||
* Tests the deprecation notices of the layout builder element.
|
||||
*
|
||||
* @coversDefaultClass \Drupal\layout_builder\Element\LayoutBuilder
|
||||
*
|
||||
* @group layout_builder
|
||||
*/
|
||||
class LayoutBuilderElementTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testConstructorTempStoreDeprecation() {
|
||||
$this->expectDeprecation('The event_dispatcher service should be passed to LayoutBuilder::__construct() instead of the layout_builder.tempstore_repository service since 9.1.0. This will be required in Drupal 10.0.0. See https://www.drupal.org/node/3152690');
|
||||
$layout_temp_storage = $this->prophesize(LayoutTempstoreRepositoryInterface::class);
|
||||
$element = new LayoutBuilder(
|
||||
[],
|
||||
'element_id',
|
||||
[],
|
||||
$layout_temp_storage->reveal()
|
||||
);
|
||||
$this->assertNotNull($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testConstructorMessengerDeprecation() {
|
||||
$this->expectDeprecation('Calling LayoutBuilder::__construct() with the $messenger argument is deprecated in drupal:9.1.0 and will be removed in drupal:10.0.0. See https://www.drupal.org/node/3152690');
|
||||
$event_dispatcher = $this->prophesize(EventDispatcherInterface::class);
|
||||
$messenger = $this->prophesize(MessengerInterface::class);
|
||||
|
||||
$element = new LayoutBuilder(
|
||||
[],
|
||||
'element_id',
|
||||
[],
|
||||
$event_dispatcher->reveal(),
|
||||
$messenger->reveal()
|
||||
);
|
||||
$this->assertNotNull($element);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\layout_builder\Kernel;
|
||||
|
||||
@trigger_error(__NAMESPACE__ . '\SectionStorageTestBase is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Tests\layout_builder\Kernel\SectionListTestBase instead. See https://www.drupal.org/node/3091432', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Provides a base class for testing implementations of section storage.
|
||||
*
|
||||
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
|
||||
* \Drupal\Tests\layout_builder\Kernel\SectionListTestBase instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/3091432
|
||||
*/
|
||||
abstract class SectionStorageTestBase extends SectionListTestBase {
|
||||
|
||||
/**
|
||||
* The section list implementation.
|
||||
*
|
||||
* @var \Drupal\layout_builder\SectionListInterface
|
||||
*/
|
||||
protected $sectionStorage;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
// Provide backwards compatibility.
|
||||
$this->sectionStorage = $this->sectionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the section list.
|
||||
*
|
||||
* @param array $section_data
|
||||
* An array of section data.
|
||||
*
|
||||
* @return \Drupal\layout_builder\SectionListInterface
|
||||
* The section list.
|
||||
*/
|
||||
abstract protected function getSectionStorage(array $section_data);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getSectionList(array $section_data) {
|
||||
// Provide backwards compatibility.
|
||||
return $this->getSectionStorage($section_data);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue