When I check the box for "Strip html", I'm seeing some output from one of my videos inserted using the Media and media_youtube module.
Here is a sample of what is displayed in the teaser:
This is some test content. This is some test content. Video of Cat Man Do - Simon's Cat Here is a test Here is another list item Here is another list item Design to theme Here is some highlighted text This is a paragraph that flows around an image. This is a paragraph that...
The media module inserts code like:
<p>[[{"fid":"110","view_mode":"4_x_3_video","type":"media","attributes":{"height":360,"width":480,"alt":"Cat Man Do - Simon's Cat","class":"media-element file-4-x-3-video"}}]]</p>
Notice the "Video of Cat Man Do - Simon's Cat?" I would think that whole phrase should be stripped out since it is just a youtube video that was inserted using the media module.
Any ideas on how I can fix this?
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | smart_trim-2041053-token_stripping-17.patch | 530 bytes | markie |
| #16 | smart_trim-strip_media_tokens-2041053-16.patch | 1.73 KB | jonraedeke |
Comments
Comment #1
chrisjlee commentedMedia module is not integrated at the moment and probably won't be considered at the moment. Otherwise i think your best bet at the moment would be to write a custom formatter for your case.
Regardless, patches are welcome.
Comment #2
damienmckennaSupport for the Media module's embedded code is a feature request.
Comment #3
frankcarey commentedAny reason not to strip things AFTER all the input formats have processed any tokens or related items? (I assume the module stores or caches the results?)
Comment #4
Andreas Radloff commentedHow about this patch? Added option to strip media tags.
Comment #5
Andreas Radloff commented@frankcarey the reason is that the caption text field that the media module inserts does not count as html and as such remains after the html has been stripped. Therefore you must strip media tokens before they are converted to markup.
Comment #6
mkhamash commentedRe-roll for the patch., wrong patch file see the one in the next comment.Comment #7
mkhamash commentedOw that is the same old one, here is the reroll.
Comment #8
rrrob commentedRerolled and cleaned up.
Comment #9
dwwI ran into the same problem, and patch #8 is working nicely to solve it. Applies cleanly to the end of the 7.x-1.x branch. Adheres to coding standards. Works well on my test sites. Doesn't introduce any obvious problems (at least to my eyes). ;) Doesn't need a migration path, since it's just a new checkbox option. RTBC! :)
Thanks,
-Derek
Comment #10
mkhamash commentedI have been using this patch for quite a long time now on multiple projects, I think it is safe to commit it.
Comment #11
didebruNot working for me :(
I have updated to latest dev.
As I implemented the patch I got this :
Than I did it manually but when I check the new option nothing happens.....
Comment #12
markie commentedPatch #8 needs re-rolling. Thanks
Comment #13
gmclelland commentedFYI.. There is a similar issue in the media module queue.
#2165457: Create text filter "Remove media tags"
Comment #14
omerida commentedHere's a re-rolled version of #8 which applied for me:
Comment #15
markie commented@omerida patch is relative to root, (/html/sites/all/modules/contrib/smart_trim/smart_trim.module) and should be ran from the smart_trim folder.
Comment #16
jonraedeke commentedRerolled to work with latest dev.
This feature request is really useful, especially when using smart trim for Metatag tokens.
Comment #17
markie commentedAll
I went a different direction with this. I figure the media code and all tokens are part of the HTML that needs to be counted, so I added a `token_replace` before the word counts which formats the media tokens into HTML and then it is part of the count with the HTML instead of the token code. Please see attached patch.
Comment #18
anybodyAlso see #3301743: Support tokens in more text and replace in content before trimming (Drupal 8+) which is closely related and could benefit from #17's approach!
Anyway, I guess
token_replace()needs a check if the token module is enabled?If #17 works correctly, I think that would be the best solution, but would need an IF around it to check if token module is enabled.
Comment #19
markie commentedDrupal 7 is EOL. If this applies to 2.x please reopen and update to that branch.