-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EWPP-82: Allow to configure a text format for the video iframe source. #117
Conversation
modules/oe_media_iframe/src/Plugin/Field/FieldFormatter/MediaIframeFormatter.php
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/src/Plugin/Field/FieldWidget/MediaIframeWidget.php
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/src/Plugin/Field/FieldFormatter/MediaIframeFormatter.php
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/tests/src/Functional/MediaIframeFormatTest.php
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/config/install/filter.format.oe_media_iframe.yml
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/src/Plugin/Field/FieldWidget/MediaIframeWidget.php
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/src/Plugin/Field/FieldWidget/MediaIframeWidget.php
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/src/Plugin/Field/FieldFormatter/MediaIframeFormatter.php
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/config/install/filter.format.oe_media_iframe.yml
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/src/Plugin/Field/FieldWidget/MediaIframeWidget.php
Outdated
Show resolved
Hide resolved
*/ | ||
public function testMediaSourceTextFormats(): void { | ||
foreach ($this->getFixtures() as $test_data) { | ||
$media = $this->storage->create([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better if you create a new media type with the iframe source to make sure the text format works for any media type instead of testing the video iframe type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brummbar What do you think should we build media type programmatically? Do we have plans that this particular media source could be used in other media types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it will be used in 1 more at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
*/ | ||
function oe_media_iframe_post_update_00001() { | ||
$format = \Drupal::entityTypeManager()->getStorage('filter_format')->create([ | ||
'format' => 'oe_media_iframe', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory, this should not exist but if the format "oe_media_iframe" was created by someone using this component, it will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
modules/oe_media_iframe/config/install/core.entity_form_display.media.video_iframe.default.yml
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/src/Plugin/Field/FieldFormatter/MediaIframeFormatter.php
Show resolved
Hide resolved
modules/oe_media_iframe/src/Plugin/Field/FieldWidget/MediaIframeWidget.php
Outdated
Show resolved
Hide resolved
*/ | ||
public function testMediaSourceTextFormats(): void { | ||
foreach ($this->getFixtures() as $test_data) { | ||
$media = $this->storage->create([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it will be used in 1 more at least.
modules/oe_media_iframe/src/Plugin/Field/FieldWidget/MediaIframeWidget.php
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/src/Plugin/Field/FieldWidget/MediaIframeWidget.php
Show resolved
Hide resolved
/** | ||
* Test text formats selected for Media source. | ||
*/ | ||
public function testMediaSourceTextFormats(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make one test for the widget configuration that gets reflected in the backend. One kernel test that checks the formatter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
modules/oe_media_iframe/config/install/filter.format.oe_media_iframe.yml
Outdated
Show resolved
Hide resolved
af834ed
to
95d6ac6
Compare
modules/oe_media_iframe/config/schema/oe_media_iframe.schema.yml
Outdated
Show resolved
Hide resolved
modules/oe_media_iframe/src/Plugin/Field/FieldFormatter/MediaIframeFormatter.php
Outdated
Show resolved
Hide resolved
$media_type = $this->entityTypeManager->getStorage('media_type')->load($this->fieldDefinition->getTargetBundle()); | ||
$text_format = $media_type->getSource()->getConfiguration()['text_format'] ?? NULL; | ||
|
||
$element = $main_widget['value']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sergepavle The problem is that you are only returning the 'value'
of the main widget. You add to that and return that but the problem is you then lose the top level array inside $main_widget
OPENEUROPA-[Insert ticket number here]
Description
[Insert description here]
Change log
Commands