Este listener une los módulos de contenido que se han generado
con el evento edemy_content, pre y post.
La template que utiliza para esta función es snippets/content_join.html.twig

@param ContentEvent $event
@return bool
180289
public function onContent(ContentEvent $event)
    {
        $content = null;
        $event->clearModules();
        $this->start('precontent_module');
        $this->eventDispatcher->dispatch('edemy_precontent_module', $event);
        var_dump('preContentModule: ' . $this->stop('precontent_module')->getDuration());

        $this->start('routeContent');
        $this->eventDispatcher->dispatch($event->getRoute(), $event);
        var_dump('routeContent ' . $event->getRoute() . ': ' . $this->stop('routeContent')->getDuration());

        //die(var_dump($event));
        if($event->isPropagationStopped()) {

            return false;
        }
        $this->start('postcontent_module');
        $this->eventDispatcher->dispatch('edemy_postcontent_module', $event);
        var_dump('postContentModule: ' . $this->stop('postcontent_module')->getDuration());
        $event->setContent(
            $this->render("snippets/join", array(
                'modules' => $event->getModules()
            ))
        );

        return true;
    }
882184
public function resolveContentOnPostSerialize(ObjectEvent $event)
    {
        $article = $event->getObject();
        $visitor = $event->getVisitor();
        $context = $event->getContext();

        if (!$article instanceof ArticleInterface || !$context->attributes->containsKey('website')) {
            return;
        }

        $visitor->addData('uuid', $context->accept($article->getArticleUuid()));
        $visitor->addData('pageUuid', $context->accept($article->getPageUuid()));

        $extensionData = $article->getExtensionsData()->toArray();
        $extension = [];
        foreach ($extensionData as $name => $data) {
            $extension[$name] = $this->extensionManager->getExtension('article', $name)->getContentData($data);
        }

        $visitor->addData('extension', $extension);
    }
698766
public function construct(ConstructEvent $event)
    {
        if ($event->getTwig()->hasExtension(StringLoaderExtension::class)) {
            return;
        }

        // Twig core extensions
        $event->getTwig()->addExtension(new StringLoaderExtension());
        $event->getTwig()->addExtension(new DebugExtension());

        // CakePHP bridging extensions
        $event->getTwig()->addExtension(new Extension\I18n());
        $event->getTwig()->addExtension(new Extension\Time());
        $event->getTwig()->addExtension(new Extension\Basic());
        $event->getTwig()->addExtension(new Extension\Number());
        $event->getTwig()->addExtension(new Extension\Utils());
        $event->getTwig()->addExtension(new Extension\Arrays());
        $event->getTwig()->addExtension(new Extension\Strings());
        $event->getTwig()->addExtension(new Extension\Inflector());

        if (!Configure::check('WyriHaximus.TwigView.flags.potentialDangerous') ||
            (
                Configure::check('WyriHaximus.TwigView.flags.potentialDangerous') &&
                Configure::read('WyriHaximus.TwigView.flags.potentialDangerous') === true
            )
        ) {
            $event->getTwig()->addExtension(new Extension\PotentialDangerous());
        }

        // Markdown extension
        if (Configure::check('WyriHaximus.TwigView.markdown.engine') &&
            Configure::read('WyriHaximus.TwigView.markdown.engine') instanceof MarkdownEngineInterface
        ) {
            $engine = Configure::read('WyriHaximus.TwigView.markdown.engine');
            $event->getTwig()->addExtension(new MarkdownExtension($engine));
            $event->getTwig()->addTokenParser(new MarkdownTokenParser($engine));
        }

        // Third party cache extension
        $cacheProvider = new Cache();
        $cacheStrategy = new LifetimeCacheStrategy($cacheProvider);
        $cacheExtension = new CacheExtension($cacheStrategy);
        $event->getTwig()->addExtension($cacheExtension);

        // jasny/twig-extensions
        $event->getTwig()->addExtension(new DateExtension());
        $event->getTwig()->addExtension(new PcreExtension());
        $event->getTwig()->addExtension(new TextExtension());
        $event->getTwig()->addExtension(new ArrayExtension());
        // @codingStandardsIgnoreEnd
    }
937261
public static function onApplicationReady(Event $event)
    {
        $app = $event->getTarget();

        $twigAdapter = $app->getRenderer()->getAdapter('twig');
        if (null === $twigAdapter) {
            return;
        }

        foreach ($app->getContainer()->findTaggedServiceIds('twig.extension') as $id => $data) {
            $twigAdapter->addExtension($app->getContainer()->get($id));
        }
    }
1261695
public function setContent( Content $content )
    {
        foreach ( $this->handlers as $handler )
        {
            if ( $handler instanceof ContentAwareHandlerInterface )
            {
                $handler->setContent( $content );
            }
        }
    }
716995
def dom_content_event
      @dom_content_event ||= begin
                               ts = @events.select { |event|
                                 event.is_a?(DomContentEventFired)
                               }.slice(0,1).map(&:timestamp).first
                               ts ? (ts - start_time).round(3) : nil
                             end
    end
543694
public function generateTextBody(ComposerEvent $event)
    {
        $parts = $event->getBody()->getParts();

        $htmlBody = null;
        $htmlPart = null;
        $textBody = null;

        // locate HTML body
        foreach ($parts as $part) {
            foreach ($part->getHeadersArray() as $header) {
                if ($header[0] == 'Content-Type' && strpos($header[1], 'text/html') === 0) {
                    $htmlPart = $part;
                    $htmlBody = $part->getRawContent();
                } elseif ($header[0] == 'Content-Type' && strpos($header[1], 'text/plain') === 0) {
                    $textBody = $part->getRawContent();
                }
            }
        }

        if ($textBody || !$htmlBody) {
            // can only work if HTML body exists and text doesn't
            return;
        }

        // create and insert text body
        $textBody = strip_tags($this->br2nl($htmlBody));
        $textPart = new MimePart($textBody);
        $textPart->type = 'text/plain';
        $event->getBody()->setParts([$textPart, $htmlPart]);

        // force multipart/alternative content type
        $event->getMessage()->getHeaders()->get('content-type')->setType('multipart/alternative')
            ->addParameter('boundary', $event->getBody()->getMime()->boundary());
    }
152273
public static function onFlushContent(Event $event)
    {
        $content = $event->getTarget();
        if (!($content instanceof AbstractClassContent)) {
            return;
        }

        $page = $content->getMainNode();
        if (null === $page) {
            return;
        }

        $url = $page->getUrl(false);
        if (!empty($url) && in_array($page->getUid(), self::$alreadyDone)) {
            return false;
        }

        $newEvent = new Event($page);
        $newEvent->setDispatcher($event->getDispatcher());
        self::onFlushPage($newEvent);
    }
201169
function setContent(content) {

            if (content.nodeType !== undefined) {
                that._content.innerHTML = '';
                that._content.appendChild(content);
            } else {
                that._content.innerHTML = content;
            }


            that._options.cache = true;

            /**
             * Event emitted when the content change.
             * @event ch.Content#contentchange
             * @private
             */
            that.emit('_contentchange');

            /**
             * Event emitted if the content is loaded successfully.
             * @event ch.Content#contentdone
             * @example
             * // Subscribe to "contentdone" event.
             * component.on('contentdone', function (event) {
             *     // Some code here!
             * });
             */
            that.emit('contentdone');
        }
70465
public function match(Event $event) : bool
    {
        $filter = $this->filter;
        if (!$filter) {
            return true;
        }
        if (is_string($filter)){
            return $this->matchEventName($filter, $event);
        }
        if (is_callable($filter)){
            return ($filter)($event);
        }
        return false;
    }
826789
public function onPreContentView(PreContentViewEvent $event): void
    {
        $currentRequest = $this->requestStack->getCurrentRequest();
        if (!$currentRequest instanceof Request) {
            return;
        }

        $view = $currentRequest->attributes->get('view');
        if (!$view instanceof ContentValueView) {
            return;
        }

        if ($currentRequest->attributes->get('viewType') !== 'full') {
            return;
        }

        $content = $view->getSiteContent();
        if (!$content->hasField('css_class') || $content->getField('css_class')->isEmpty()) {
            return;
        }

        $fieldValue = $content->getField('css_class')->value;
        if (!$fieldValue instanceof TextLineValue) {
            return;
        }

        $event->getContentView()->addParameters(
            [
                'page_css_class' => trim($fieldValue->text),
            ]
        );
    }
411662
public function preRender(Event $event)
    {
        $markdown = $event->getParam('markdown');

        $markdownHash = md5($markdown);

        $success = false;
        $renderedMarkdown = $this->cache->getItem($markdownHash, $success);
        if ($success) {
            $event->stopPropagation(true);

            return $renderedMarkdown;
        }

        return false;
    }
607931
public function setViewTemplates(PreContentViewEvent $event)
    {
        $view = $event->getContentView();

        foreach ($this->viewTemplates as $viewClass => $template) {
            if ($view instanceof $viewClass) {
                $view->setTemplateIdentifier($template);
                $view->addParameters(['pagelayout' => $this->pagelayout]);
            }
        }
    }
1358712
protected function getFormattedTags(Event $event)
    {
        $tags = [];
        foreach ($event->getTags() as $key => $value) {
            if (is_bool($value)) {
                $value = $value ? 'true' : 'false';
            }
            $tags[] = "$key:$value";
        }

        return empty($tags) ? '' : '|#'.implode(',', $tags);
    }
485806
public function onContentChanged($event)
    {
        $sender = $event->sender;
        // If it is permitted to change content, then it will return directly.
        if ($sender->permitChangeContent) {
            return;
        }
        // The messgage will be reversed if it changed (current message isn't
        // same as the old).
        $cAttribute = $sender->contentAttribute;
        $oldContent = $sender->getOldAttribute($cAttribute);
        if ($oldContent != $sender->$cAttribute) {
            $sender->$cAttribute = $oldContent;
        }
    }
1361743
public static function onFlushContent(Event $event)
    {
        if (null === self::getEntityManager($event)) {
            return;
        }

        $contents_inserted = ScheduledEntities::getScheduledAClassContentInsertions(self::$em, true, true);
        $contents_updated = ScheduledEntities::getScheduledAClassContentUpdates(self::$em, true, true);
        $contents_deleted = ScheduledEntities::getSchedulesAClassContentDeletions(self::$em, true);

        // Updates content-content indexes
        self::updateIdxContentContents(array_merge($contents_inserted, $contents_updated), $contents_deleted);

        // Updates site-content indexes
        self::updateIdxSiteContents($contents_inserted, $contents_deleted);

        $content = $event->getTarget();
        if (!($content instanceof AbstractClassContent)) {
            return;
        }
        $dispatcher = $event->getDispatcher();
        $application = $dispatcher->getApplication();
        if (null === $application) {
            return;
        }

        $uow = self::$em->getUnitOfWork();

        if ($uow->isScheduledForInsert($content) || $uow->isScheduledForUpdate($content)) {
            self::$em->getRepository('BackBee\ClassContent\Indexes\OptContentByModified')
                    ->replaceOptContentTable($content);

            self::indexContent($content);
            self::updateSuperContentIndexes($content);
        } elseif ($uow->isScheduledForDelete($content)) {
            self::$em
                ->getRepository('BackBee\ClassContent\Indexes\OptContentByModified')
                ->removeOptContentTable($content)
            ;

            foreach ($content->getIndexation() as $index) {
                self::$em->remove($index);
                self::$em
                    ->getUnitOfWork()
                    ->computeChangeSet(self::$em->getClassMetadata('BackBee\ClassContent\Indexation'), $index)
                ;
            }
        }
    }
715634
public function onInitContentType($event)
    {
        $sender = $event->sender;
        /* @var $sender static */
        if (!is_string($sender->contentTypeAttribute) || empty($sender->contentTypeAttribute)) {
            return;
        }
        $contentTypeAttribute = $sender->contentTypeAttribute;
        if (!isset($sender->$contentTypeAttribute) &&
            !empty($sender->contentTypes) &&
            is_array($sender->contentTypes)) {
            $sender->$contentTypeAttribute = $sender->contentTypes[0];
        }
    }