In the insert_element_process() function, the insert_content() is called to get the HTML for insertion.
I do not understand why is the variable $field['widget'] used instead of simplyu $field, that would allow for example to know the name of the processed field.

This could be very signifiant for modules like lightbox, for which it could be possible to use the field name for grouping.

I understand that modifying such a thing means lots of changes, even in related modules :(

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Insert module is only related to the field on the add or edit forms (e.g. the "widget"). It doesn't matter in any way if Insert has been used when viewing a piece of content on output. Typically injecting settings into $field should only be done with that has an effect on the data itself.

Also by saving the values in $field['widget'], it makes it so those settings are appropriately removed if the user changes the widget later (such as to a widget that doesn't support Insert, like Plupload).

B-Prod’s picture

Actually I do not want to save anything in the $field settings.

The purpose is to give to other contributed modules the $field variable entirely, so these module could use the populoated value in $field variable, like field_name for example.

This only concerns the element processing operation, nothing else.

Here is a patch to show you what I am speaking about.

The real problem of this change is to update the others related modules so they use the $field variable and not the $widget one. I can help you for that if you need, I understand it could be a big work.

quicksketch’s picture

Hm. I know I had a reason for using $widget instead of $field, it seems odd that I would intentionally restrict down the information.

The real problem of this change is to update the others related modules so they use the $field variable and not the $widget one. I can help you for that if you need, I understand it could be a big work.

To start, you could go through all the integrations that Insert module includes (all the .inc files in "includes") and update those. Right now this would be a sloppy change not updating any of our own variables.

B-Prod’s picture

Status: Active » Needs review
FileSize
7.21 KB

I also updated the theme arguments in hook_theme() function, so those who use for example some classes with field name to style their contents could now avoid to duplicate their CSS rules.

I added $field variable explanation in the applicable template files.

quicksketch’s picture

Status: Needs review » Closed (won't fix)

I don't think we can change these settings at this point without breaking a lot of sites, both in theming and in add-on contrib/custom modules. At least as far as D6 is concerned, we're not going to undertake major API changes at this point.

B-Prod’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Closed (won't fix) » Active

This is very sad, since it causes a big restriction in the possible way to react on an insert action. Could we hope to ever see such improvement in the 7.x version though?

quicksketch’s picture

In Drupal 7, widget and field settings are very explicitly separated, they're even on separate screens in the UI (field settings first, then widget + field settings on the second page). In that situation I don't think we could move them at all, and if we did, it would have to be in a 2.x branch.

B-Prod’s picture

Both can easily be retrieved from the field instance. If you need some help to work on a 2.x branch, I would be glad to help. In such case a list of other improvements/new features would be a good start for thinking about this new branch. Just let me know...

Snater’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Browsing through old tickets while working on the module's D8 version, I am closing this ticket due to its age. I had a look at the desired change and, although it is reasonable, it would require a new major version (7.x-2.0), as pointed out. That said, I am sure quite some modules relying on the interface that would be changed, might not adapt that interface change, as module administration is abandoned or module maintainers concentrate on D8 versions by now. Site owners, upgrading Insert in good faith might end up with a broken page. I think time is up for implementing interface changes in the module's D7 version.