Problem/Motivation
Media entity used to provide custom validation API to be used by type plugins. In #2529178: Convert media type validation code to a constraint we converted this feature to core's Constraint API. All media type providers need to follow that change.
Proposed resolution
Media entity embeddable video should follow this change too. Media entity Twitter already did that in #2578927: [Chase media_entity] Convert validation to Constraints API and can be used as a reference.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | media_entity_embeddable_video-interface-attach_constraints-2578947-14.patch | 1.16 KB | pixelmord |
| #12 | config-dfxg9-ply-st-2015-10-28-18-14.tar_.gz | 27.99 KB | axe312 |
| #12 | Screen Shot 2015-10-28 at 19.14.20.png | 56.98 KB | axe312 |
Comments
Comment #2
rosinegrean commentedComment #3
ehegedus commentedI'm on it.
Comment #4
primsi commentedPull: https://github.com/drupal-media/media_entity_embeddable_video/pull/8
I am not sure that that's the way we wanted to approach that.
Comment #5
slashrsm commentedFew comments on PR.
Comment #6
primsi commentedThanks, addressed comments and added tests. Do we need the travis config file also? Or are we doing that in a separate ticket?
Comment #7
slashrsm commentedOne comment. Yes, Travis script would be great!
Comment #8
primsi commentedAddressed coments. I propose adding the travis script in a separate ticket.
Comment #9
slashrsm commentedOK, lets open a followup. Merged.
Comment #11
primsi commentedFollow up #2601826: Fix travis integration
Comment #12
axe312 commentedSorry, but this is not working for youtube video urls on a link field. I attached a screenshot and a exported configuration for simplytest.me
Comment #13
yannickooI can confirm this! First I thought axe312 forgot the
wwwin the URL but even with the URL from code it doesn't work :/Comment #14
pixelmord commentedThe reason here is that the regular expression is not matched against the url of the field.
Attached a patch and created a PR in github
Comment #15
pixelmord commentedHere's the PR on GH
https://github.com/drupal-media/media_entity_embeddable_video/pull/10
Comment #16
primsi commentedThis would break bundles, where the field doesn't use \Drupal\Core\TypedData\Plugin\DataType\Uri, ie text areas, text fields...
I am trying to find a way to get the value in a generic way. Hopefully will come up with a PR shortly.
Comment #17
primsi commentedI've tested this approach and it seems to work for plain text field and for link fields.
Pull: https://github.com/drupal-media/media_entity_embeddable_video/pull/11
Comment #18
primsi commentedOh, forgot. I noticed that youtube links without www fail validation anyway. That's because of the regexe syntax. If we wanted to fix that, I suggest opening a new ticket.
Comment #19
primsi commentedComment #20
slashrsm commentedLooks good. Two comments on pull.
Youtube links follow-up: #2605522: Support Youtube links without www
Comment #21
primsi commentedAddressed comments.
Comment #22
slashrsm commentedMerged. Thanks.
Also opened #2606626: Fix Travis CI integration.