Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time

Custom Configuration

If the available configurability is not sufficient, you can now extend the configuration with your own fields.


Create an eventlistener that listens to the NewsEvents::NEWS_BRICK_QUERY_BUILD event

  namespace AppBundle\EventListener;
  use NewsBundle\Event\NewsBrickEvent;
  use NewsBundle\NewsEvents;
  use Pimcore\Model\Document\PageSnippet;
  use Pimcore\Model\Document\Tag\Relations;
  use Pimcore\Templating\Renderer\TagRenderer;
  use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  class NewsBrickModifierListener implements EventSubscriberInterface
       * @var TagRenderer
      protected $tagRenderer;
       * @param TagRenderer $tagRenderer
      public function __construct(TagRenderer $tagRenderer)
          $this->tagRenderer = $tagRenderer;
       * @return array
      public static function getSubscribedEvents()
          return [
              NewsEvents::NEWS_BRICK_QUERY_BUILD => 'modifyBrick'
       * @param NewsBrickEvent $event
      public function modifyBrick(NewsBrickEvent $event)
          $querySettings = $event->getQuerySettings();
          $document = $event->getInfo()->getDocument();
          $configuration = $this->getDocumentTag($document, '<yourpropertytype>', '<yourproperty>');
          # crucial: check properly
          if (!$configuration instanceof Relations) {
          $elements = $configuration->getElements(); // or whatever Method applies to your Class 
          $querySettings['<yourproperty>'] = $elements;
       * @param PageSnippet $document
       * @param string      $type
       * @param string      $inputName
       * @param array       $options
       * @return \Pimcore\Model\Document\Tag|null
      protected function getDocumentTag(PageSnippet $document, $type, $inputName, array $options = [])
          return $this->tagRenderer->getTag($document, $type, $inputName, $options);

Service registration

        autowire: true
        autoconfigure: true
        public: false
            - { name: kernel.event_subscriber }


Create a new File in your app-resource-directory: NewsBundle/view/Areas/news/edit_custom.html.twig and use common pimcore-methods to add your configuration:

<div class="t-row">
    <div class="t-col-full">
        <label>{{ 'news.<yourpropertyname>'|trans({}, 'admin') }}</label>
        {{ pimcore_your_property_type('<yourproperty>', {
            'types'    : ['object', 'folder'],
            'width'    : '510px',
            'height'   : '150px',
        }) }}

Modify Listing

Create a class that extends \NewsBundle\Model\Entry and add this method to use your new configuration-values

     * @param DataObject\NewsEntry\Listing $listing
     * @param array                        $settings
    protected static function modifyListing($listing, $settings = [])
        # for example, add a condition
        $listing->addConditionParam('<define your condition>');