Is-it possible to add atoms in a block or in a box (same as block, but coming from the boxes module)?
I assume we should :
1) Add this code:

$conf['mee_field_types'] = array('text_with_summary', 'text_long');

in the settings.php file
(or... this is a side question... why this drush statement doens't work: drush php-eval "variable_set('mee_field_types',array('text_with_summary', 'text_long'));")
2) ??? I am lost here

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jcisio’s picture

Currently you can't, because block does not use text field (at least in D7, in D8 it won't be a problem with the block_custom module) and Scald only works with fields. So you will need a "Scald filter". That should not be too difficult to implement.

DuneBL’s picture

Many thanks for your so quick answer!
If I understand you well, using

$conf['mee_field_types'] = array('text_with_summary', 'text_long');

will not help me because blocks are not made of 'text_long' field.

Could you let me know what is a "Scald filter"... do you mean an input text filter?

Don't you think having blocks using scald as well would be a nice feature?

Thanks again

jcisio’s picture

Yes. And yes, it would be a nice feature.

jcisio’s picture

Also, you might want to try Bean Scald. Bean is better Block.

DuneBL’s picture

You are the boss!!!
I will try it tomorow and will provide my feedback here as I have to leave right now

DuneBL’s picture

Bean Scald
Here are the conclusions of my testing of "Bean Scald":
You can use this module if you want quickly a block type that is supporting Scald... (features and beans are dependencies) but you need to add a text field yourself.

Without using "Bean Scald":
For those who don't knew the bean module like me, this is the solution: just install/enable it and you will be able to create your own block type and then add fields that are supporting DnD of scald media.

It was what I was waiting for!
Thanks you!!

jcisio’s picture

Title: Impossible to add atoms in the body field of a block (or a box) » Create a scald filter so that it works with things other than text fields
mavin’s picture

Hello,

The attached patch activates the drag and drop library for native Drupal blocks, so that you can add atoms in your blocks.

dDoak’s picture

Hi,

Any feedbacks on this patch? At least, it works for native blocks.

Thanks

discipolo’s picture

concerning bean scald actually there is a text field and a Atom Reference field. i am just not getting additional contexts to work.

discipolo’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Component: Scald core » Library/DnD
Status: Active » Needs review

this patch applies cleanly and performes as advertised! i am experiencing issues when deleting atoms that were inserted into blocks though, will investigate deeper

regrettably contexts passthrough an imagestyle for youtube videos doesnt work for me here either. but that is a seperate issue.

jcisio’s picture

Status: Needs review » Needs work

Well, it is not a format filter. However, it's a very nice patch that proves how easily integrate Scald DnD into a block. Needs work because it bypasses the access control (per #11), or it goes into a Scald extras or Scald block modules, with those known limitations.

henrikakselsen’s picture

#8 seems to work fine, haven't got any issues so far.

davidhk’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
722 bytes

The patch adds a basic input filter that can be used to convert SAS to HTML.

JonesUI’s picture

This patch is working for me (with a minor caveat: https://drupal.org/comment/8663319#comment-8663319).

jcisio’s picture

Status: Needs review » Needs work

Add a description about the security implication and best pratices to use it, then I think it is good to go.

davidhk’s picture

If I make this change to documentation page https://drupal.org/node/1775718, will it be ok?

I don't understand the security risks of switching to use a filter, please can you explain?

Regards, David

Using a textarea field

First you'll want to allow users to embed atoms into the text.

  • Enable the MEE module
  • In the text field settings (enable Field UI module, go to Structure > Content Types, click on the "manage fields" associated to the content type you want to configure, then click "edit" next to), there are two new options that can be enabled:
    1. "Drag'n'Drop Enabled" (allow drag and drop directly into this textarea)
    2. "MEE Enabled" (allow to track the embedded atoms, to unpublish node based
      on (primary) atom copyright expiration etc.)

    Enable the DnD option, and optionally the MEE option.

  • In the CKEditor setting, enable the "Scald DnD integration" plugin and move the button into toolbar. This plugin allows you to change the context and override atom settings directly in the textarea.

Now when a user edits the field, they can use the Scald library browser to select and embed atoms into the text.

Displaying embedded atoms in a textarea field

After editing and saving the text, any embedded atoms are stored as tokens in the SAS text format. At display time, these tokens must be converted back to a rendered atom. If you enabled "Drag'n'Drop Enabled" for this field, the conversion happens automatically. This conversion happens after all of Drupal's filters have run.

It is recommended that you disable the "Convert URLs into links" filter for any text formats that will be used with this field. Otherwise the SAS tokens may be altered, potentially preventing their later conversion to rendered atoms.

But I must use the "Convert URLs into links" filter

You have the option to convert SAS tokens to rendered atoms using a filter. Edit the text formats that will be used for this field, and in the "Enabled filters" section, make sure that "Convert Scald SAS to HTML" is selected.

Then in the "Filter processing order" section, make sure that the "Convert Scald SAS to HTML" filter is executed before the "Convert URLs into links" filter.

davidhk’s picture

Status: Needs work » Needs review
jcisio’s picture

Status: Needs review » Active

Several security problems:

- Filter cache must be disabled unless you don't want to do control access.
- Generally, the Scald filter should be executed last, because it generate a lot of markup and sensible HTML tags (picture, iframe, noscript etc.). The "Convert URLs into links" filter is usually the first one to be executed, before any HTML clean up. So, in this use case, if you want to run Scald filter before "Convert URLs into links" filter, it may work for some simple provider (image with simple markup), but not all.

The more I think of it, the more I lean towards creating a separate scald_filter module that people could enable if they want, then if that filter is enabled for a text format, then attach the library to it. With this module enabled, you can bypass the MEE module and its field based approach.

If you can't create a full project, I can create one and add you as co-maintainer.

davidhk’s picture

Thanks for the explanations. So after the above documentation, I'd add:

Points to note when using the Scald filter:
- If the text format is cacheable, you lose Scald's access control functionality. The rendered atom is displayed to users from the cache, without regard to their permissions.
- Generally, the Scald filter should be executed last, because it generates a lot of markup and sensible HTML tags (picture, iframe, noscript, etc.). The "Convert URLs into links" filter is usually the first one to be executed, before any HTML clean up. So, in this use case, if you want to run Scald filter before "Convert URLs into links" filter, it may work for some simple provider (eg image with simple markup), but not all.

I agree with the alternative module to MEE you describe, but sorry, I don't have the ability or time to handle a project. I'm learning just enough to get my migration finished, but then will go back to running the site. If that means the change can't make it in to Scald, I understand and will just use the code locally.

Regards, David

jcisio’s picture

Status: Active » Fixed

This issue has attention from many people so that I went ahead and created https://drupal.org/project/scald_filter. Further discussion will be there.

@davidhk I've added you as co-maintainer of that module so that you don't have to wait for committing stuffs that are useful for many people. Of course if you don't want it, I'll remove.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.