Closed (fixed)
Project:
Custom Elements
Version:
8.x-1.0-beta5
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Aug 2018 at 14:13 UTC
Updated:
9 May 2019 at 15:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
fago- This needs to check it's working with node articles first.
this doe snot make sense to me. it should either just use the plain value without json encding or the ->processed field if markup is there
Let's just stay with an uri attribute. Why would we generate a pinterest element with a pinterest_url attribute? The logical name would be URL.
This shows we really need to to do #2994914: Allow modules to control how entity fields are transformed. But let's handle this there and re-factor this later.
Comment #3
arthur_lorenz commentedAdded new patch
Comment #4
fago>Let's just stay with an uri attribute. Why would we generate a pinterest element with a pinterest_url attribute? The logical name would be URL.
Pinterest was just the example, same for others:
+ case 'twitter':
+ $entity_values->setDataAttribute('twitter_url', $media_entity->field_url->uri);
+ break;
How about instagram, isn't that included?
Comment #5
arthur_lorenz commented>Pinterest was just the example, same for others:
makes sense, fixed for twitter and instagram aswell
>How about instagram, isn't that included?
sure, it was included from the beginning ;)
Comment #6
fagoI figured that this uses related URLs for image media, but it should be absolute so that the custom element markup is re-usable. Attaching a new patch.
Still we need to address #2994914: Allow modules to control how entity fields are transformed for being able to implement this properly.
Comment #7
arthur_lorenz commentedSame issue for URLs in gallery images. New patch attached.
Comment #8
fago#2994914: Allow modules to control how entity fields are transformed is fixed in 2.x now. It has this code refacored as ThunderParagraphsCustomElementsProcessor - however that's a WIP and needs to be completely refactored still.
Todos to make this work properly:
- For each media bundle in thunder, add a MediaEntity{ bundle}Processor. The processor should support media entities and control how they are rendered.
- Since we know it's thunder we can assume the thunder fields and add an optimized custom element tag for the media entity.
- In the end, we should have a wrapping custom element tag per paragraph that contains slot elements as suiting.
Comment #9
pagach commentedPatch with default processor for thunder gallery.Wrong file. Correct file in comment #11
Comment #10
pagach commentedComment #11
pagach commentedPatch with default processor for thunder gallery.Comment #12
pagach commentedNew patch with --staged diff for added files.
Comment #13
fagosince it's working for paragraphs, $data must be the paragraph entity and the assert wrong?
This says it's handling media entities, but then it handles the paragraph type 'gallery'. Mismatch.
+ use CustomElementGeneratorTrait;
not used?
Why has the gallery a separate class and the other paragraphs not?
I think it would be cleanest to have a single class per paragraph type / media entity bundle so it can be easily extended like that and it's easy to overrride the output for a single paragraph only.
Comment #14
pagach commentedHere is a patch with all thunder paragraphs in separate class.
Also removed unused trait (it is not used since nested element "lupus-" tag and not a custom_elements tag).
Refactored to use Paragraph instead of MediaEntity.
Comment #16
fagothx, works as it should! Committed.