getConvertFunction example

public function __construct(MediaServiceInterface $mediaService)
    {
        $this->mediaService = $mediaService;
    }

    /** * @return bool */
    public function supports(Element $element)
    {
        return $element->getComponent()->getType() === self::COMPONENT_NAME
            || $element->getComponent()->getConvertFunction() === self::LEGACY_CONVERT_FUNCTION;
    }

    public function prepare(PrepareDataCollection $collection, Element $element, ShopContextInterface $context)
    {
    }

    public function handle(ResolvedDataCollection $collection, Element $element, ShopContextInterface $context)
    {
        foreach (['webm_video', 'ogg_video', 'h264_video', 'fallback_picture'] as $field) {
            $value = $element->getConfig()->get($field);

            
class BannerComponentHandler implements ComponentHandlerInterface
{
    public const LEGACY_CONVERT_FUNCTION = 'getBannerMappingLinks';
    public const COMPONENT_NAME = 'emotion-components-banner';

    /** * {@inheritdoc} */
    public function supports(Element $element)
    {
        return $element->getComponent()->getType() === self::COMPONENT_NAME
            || $element->getComponent()->getConvertFunction() === self::LEGACY_CONVERT_FUNCTION;
    }

    /** * {@inheritdoc} */
    public function prepare(PrepareDataCollection $collection, Element $element, ShopContextInterface $context)
    {
        $collection->addMediaPaths([$element->getConfig()->get('file')]);

        $this->generateLink($element$context);
        $this->addMappings($collection$element$context);
    }
$this->additionalTextService = $additionalTextService;
    }

    /** * {@inheritdoc} */
    public function supports(Element $element)
    {
        $component = $element->getComponent();

        return $component->getType() === self::COMPONENT_NAME
            || $component->getConvertFunction() === self::LEGACY_CONVERT_FUNCTION;
    }

    /** * {@inheritdoc} */
    public function prepare(PrepareDataCollection $collection, Element $element, ShopContextInterface $context)
    {
        $type = $element->getConfig()->get(self::SLIDER_TYPE_KEY, self::TYPE_STATIC_PRODUCT);
        $key = ComponentHandlerInterface::CRITERIA_KEY . $element->getId();

        switch ($type) {
            

        $this->manufacturerService = $manufacturerService;
        $this->connection = $connection;
    }

    /** * {@inheritdoc} */
    public function supports(Element $element)
    {
        return $element->getComponent()->getType() === self::COMPONENT_NAME
            || $element->getComponent()->getConvertFunction() === self::LEGACY_CONVERT_FUNCTION;
    }

    /** * {@inheritdoc} */
    public function prepare(PrepareDataCollection $collection, Element $element, ShopContextInterface $context)
    {
    }

    /** * {@inheritdoc} */
$this->categoryService = $categoryService;
        $this->connection = $connection;
        $this->blogService = $blogService;
    }

    /** * @return bool */
    public function supports(Element $element)
    {
        return $element->getComponent()->getType() === self::COMPONENT_NAME
            || $element->getComponent()->getConvertFunction() === self::LEGACY_CONVERT_FUNCTION;
    }

    /** * @param ShopContext|ShopContextInterface $context */
    public function prepare(PrepareDataCollection $collection, Element $element, ShopContextInterface $context)
    {
        $imageType = $element->getConfig()->get('image_type');
        $key = ComponentHandlerInterface::CRITERIA_KEY . $element->getId();

        switch ($imageType) {
            
class BannerSliderComponentHandler implements ComponentHandlerInterface
{
    public const LEGACY_CONVERT_FUNCTION = 'getBannerSlider';
    public const COMPONENT_NAME = 'emotion-components-banner-slider';

    /** * @return bool */
    public function supports(Element $element)
    {
        return $element->getComponent()->getType() === self::COMPONENT_NAME
            || $element->getComponent()->getConvertFunction() === self::LEGACY_CONVERT_FUNCTION;
    }

    public function prepare(PrepareDataCollection $collection, Element $element, ShopContextInterface $context)
    {
        $sliderList = $element->getConfig()->get('banner_slider', []);

        $collection->addMediaIds(array_column($sliderList, 'mediaId'));

        foreach ($sliderList as &$slider) {
            if (!empty($slider['link']) && !preg_match('/^(http|https):\/\//', $slider['link'])) {
                $slider['link'] = $context->getBaseUrl() . $slider['link'];
            }
$this->criteriaFactory = $criteriaFactory;
        $this->shopwareConfig = $shopwareConfig;
        $this->additionalTextService = $additionalTextService;
    }

    /** * {@inheritdoc} */
    public function supports(Element $element)
    {
        return $element->getComponent()->getType() === self::COMPONENT_NAME
            || $element->getComponent()->getConvertFunction() === self::LEGACY_CONVERT_FUNCTION;
    }

    /** * {@inheritdoc} */
    public function prepare(PrepareDataCollection $collection, Element $element, ShopContextInterface $context)
    {
        $type = $element->getConfig()->get('article_type');
        $key = ComponentHandlerInterface::CRITERIA_KEY . $element->getId();

        if ($type === self::TYPE_STATIC_PRODUCT) {
            
Home | Imprint | This part of the site doesn't use cookies.