you have $form_id_blacklist in template_picker_form_alter (line 216). It would be better to either allow template picker to be enabled per entity / bundle type on its own (then check for that) OR allow for the blacklist to be modified via alter statement. This would prevent this from firing everywhere or on entity types that it might not make sense (which is my usecase).

Example of making a configurable matrix on an admin form -- http://cgit.drupalcode.org/entity_iframe/tree/entity_iframe.admin.inc

Comments

bryanbraun’s picture

Thanks for reporting, and for the recommendations.

I've intentionally shied away from setting up a admin page for enabling/disabling template picker per entity, because I wanted to manage the enabling/disabling of each entity (and content-type) on a per-role basis and figured that I could do that all in one place on the permissions page. It has worked pretty well with only a few downsides:

  • `user1` has all permissions by default (even disabled ones) so that person still sees the template picker dialogs.
  • There are occasionally forms that display the dialog box, because those entity forms don't match up with the entities returned by entity_get_info() (which I use for printing all the entities in the permissions). I had set up the blacklist as a quick fix to address this issue.

I think that maybe an alter-hook to add to the blacklist is probably the simplest way to address the issue without reworking the fundamentals of how the feature is enabled per-role. There may be some way to address the source of the issue, (forms with isset($form['#entity_type']) don't quite line up with entities returned by entity_get_info()), but nothing that I can immediately find.

I'm tied up with some other priorities right now, but I hope to implement the alter-hook in the future. As always, patches would expedite the process. :)

drupalgideon’s picture

I know this is an old issue, but I've recently started working on a Drupal 7 project again and needed to use this module. I've created a really simple patch to allow someone to alter the blacklist IDs using a hook. Before I was putting $form['template_picker']['#access'] = FALSE; in a load of hook_form_FORM_ID_alter()s.

bryanbraun’s picture

Status: Active » Needs review

Hey, I just wanted to jump in and say that I saw your patch. It looks promising and I hope to be able to review it sometime next week.

bryanbraun’s picture

Status: Needs review » Fixed

Just tested this and it works great... I'm pushing up the commit now.

Thanks for the contribution!

Status: Fixed » Closed (fixed)

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