Hi,

I recently had to extend the node input/edit form to capture some additional data and I added a textarea to do this. However, the img_assist module like to place it's link below my textarea element. But inputting an image into this field is not an option.

I could not find a solution in the img_assist module so I modified it so that it would accept an attribute to surpress it's link display.

Patch attached. All it does is check for the existence of a ['#img_assist'] attribute and if false/zero don't display the link otherwiese the default is to display it for normal behaviour.

Regards
--AjK

Comments

darren oh’s picture

Status: Needs review » Needs work

I doubt we have much chance of getting other modules to use a form attribute specific to Img_assist. Htmlarea had a setting to allow it to be disabled for specific text areas. A similar feature would solve the problem for Img_assist without requiring other developers to change the way they create forms.

AjK’s picture

Category: feature » support
Status: Needs work » Active

That's fine. So what is the method to suppress the link in that case? Anything's better than nothing at all. I see the link all over the place in situations where it's wholey inappropiate. There has to be a method of switching it off regardless of how it's implemented?

darren oh’s picture

I don't know. If someone has time to find out, please let me know.

darren oh’s picture

Category: support » feature
AjK’s picture

Category: feature » support

Erm, I think that's a valid support request. It may be a feature but if you don't know and I don't know maybe the module maintainer would know?

darren oh’s picture

Category: support » feature

Does htmlarea still have a maintainer? The project was practically shut down by license issues. For Img_assist this would be a feature. I'll copy the feature from htmlarea when I have time to look at the code, or when someone else does.

wim leers’s picture

I think this is the cleanest solution:
1) by default, only let img_assist do its magic on textareas with an id "edit-body"
2) give the user the option to add more form id's in the settings

chx’s picture

Interested contrib authors should write a module which keeps a tally of textareas by form_id and serialized #parents and then tinymce, imgassist and whatever can use this module to disable themselves on demand.

zoo33’s picture

We already have this issue: Prevent 'Add image' link from appearing under Log. There are a couple of other ideas there. I guess this or that other issue should be marked as duplicate.

I'd be happy to review patches that give the user some way of controlling what textareas are used, but I don't have time right now to work on it myself.

wim leers’s picture

Okay. Patch upcoming. I thought I'd get some sleep first, but since you're around, I'll first get the patch finished :)

The configuration stuff is finished, just cleaning up my code.

wim leers’s picture

Assigned: Unassigned » wim leers
Status: Active » Needs review
StatusFileSize
new4.69 KB

And here's the patch! This patch does what I described in #7. It also improves the dependency check for image.module. It doesn't break any existing functionality. There might be some errors in there, because of me hurrying this out. But it's definitely working well.

Further suggestions:
-"img_assist_all" variable should be renamed to "img_assist_paths_type"
-"img_assist_pages" variable should be renamed to "img_assist_paths"
-"_img_assist_page_match()" function should be renamed to "img_assist_path_match()"

I didn't make these changes to keep the amount of code to review smaller.

zoo33’s picture

Version: 6.x-3.x-dev » 5.x-1.x-dev

That looks very promising! I'll give it a try as soon as I can.

This new option will be somewhat developer oriented or at least pretty technical. Would it be possible somehow to let users control this without looking up the form IDs? I guess the default value ("edit-body\nedit-comment") should be sufficient in most cases, the exception being CCK fields. Maybe a short explanation of what form ids are and/or where you can find them would be helpful?

wim leers’s picture

StatusFileSize
new6.38 KB

Added your request, also implemented my suggestions while I was busy. Now all path/textarea options are:

Display Image assist on paths:
on specific paths
not on specific paths
all paths

Display Image assist on textareas:
on specific textareas
not on specific textareas
on all textareas

And the guiding description (which needs to be improved):

Form-id's are used by Drupal to typify them, which allows themers and coders to modify certain form fields, but not all. Find form-id's using this method: view the source of the webpage, then search for the string that's just above of the textarea and then you'll see the form-id nearby it.

jaredwiltshire’s picture

Works for me.

wim leers’s picture

Great, jaredwiltshire!

Now we only need one of the maintainers to review & approve the patch and to commit it. I hope one of them will step up soon... perhaps we should contact zoo33?

darren oh’s picture

What we maintainers are wondering is why no one has changed the status to "ready to be committed".

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

Because AFAIK, it's not the convention on d.o. to mark the status as RTBC, but as code needs review, since it's not up to us humble patch submitters to decide on that. Or does that only apply to Drupal Core?

Marked as RTBC, per request.

darren oh’s picture

The accepted practice is for the patch author to request that the patch be reviewed and for anyone who tests the patch to change the status to "ready to be committed" if it works or "code needs work" if it doesn't. What the core developers frown on is patch authors setting the status to "ready to be committed" before anyone else has tested the patch.

wim leers’s picture

Ok, thanks for the explanation :) Will do so in the future!

zoo33’s picture

I won't be able to take care of this for another two weeks or so since I'm I'm out of town on vacation. (In fact, I'm not even writing this comment...) If darren or benshell wants to do it then go ahead!

darren oh’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in CVS commit 65519.

killes@www.drop.org’s picture

Status: Fixed » Closed (fixed)