getMedias example

'active' => $blog->isActive(),
            'shortDescription' => $blog->getShortDescription(),
            'description' => $blog->getDescription(),
            'displayDate' => $blog->getDisplayDate(),
            'categoryId' => $blog->getCategoryId(),
            'template' => $blog->getTemplate(),
            'metaKeyWords' => $blog->getMetaKeywords(),
            'metaKeywords' => $blog->getMetaKeywords(),
            'metaDescription' => $blog->getMetaDescription(),
            'metaTitle' => $blog->getMetaTitle(),
            'views' => $blog->getViews(),
            'mediaList' => array_map([$this, 'convertMediaStruct']$blog->getMedias()),
            'attributes' => $blog->getAttributes(),
        ];

        if ($blog->hasAttribute('core')) {
            $data['attribute'] = $blog->getAttribute('core');
        }

        $data['media'] = reset($data['mediaList']);

        return $this->eventManager->filter('Legacy_Struct_Converter_Convert_Blog', $data[
            'blog' => $blog,
        ]);
break;

            case self::TYPE_ARTICLE_OR_BLOG:
                $isBlog = (bool) $element->getConfig()->get('blog_category');
                $categoryId = (int) $element->getConfig()->get('category_selection');

                if ($isBlog) {
                    $blog = $this->getRandomBlog($categoryId$context);
                    if (!$blog instanceof Blog) {
                        break;
                    }
                    $medias = $blog->getMedias();
                    $media = array_shift($medias);
                    if (!$media instanceof Media) {
                        break;
                    }

                    $element->getData()->set('blog', $blog);
                    $element->getData()->set('image', $media);
                    $element->getData()->set('images', $media->getThumbnails());
                    break;
                }

                
Home | Imprint | This part of the site doesn't use cookies.