vendor/netzmacht/contao-toolkit/src/Component/ContentElement/ContentElementDecorator.php line 30

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Netzmacht\Contao\Toolkit\Component\ContentElement;
  4. use Contao\ContentElement;
  5. use Contao\ContentModel;
  6. use Contao\Database\Result;
  7. use Netzmacht\Contao\Toolkit\Component\ComponentDecoratorTrait;
  8. use Netzmacht\Contao\Toolkit\Component\ComponentFactory;
  9. use function assert;
  10. /**
  11.  * @deprecated Since 3.5.0 and get removed in 4.0.0
  12.  *
  13.  * @psalm-suppress PropertyNotSetInConstructor
  14.  * @psalm-suppress DeprecatedTrait
  15.  */
  16. final class ContentElementDecorator extends ContentElement
  17. {
  18.     use ComponentDecoratorTrait;
  19.     /**
  20.      * @param ContentModel|Result $contentModel
  21.      */
  22.     public function __construct($contentModelstring $column 'main')
  23.     {
  24.         $this->component $this->getFactory()->create($contentModel$column);
  25.     }
  26.     /** @psalm-suppress DeprecatedClass */
  27.     protected function getFactory(): ComponentFactory
  28.     {
  29.         $factory $this->getContainer()->get('netzmacht.contao_toolkit.component.content_element_factory');
  30.         /** @psalm-suppress DeprecatedClass */
  31.         assert($factory instanceof ComponentFactory);
  32.         return $factory;
  33.     }
  34. }