spending hours dealing with form_alter , finally realized that a tpl.php file is overriding the output !!!
now the question is
what are the ways to understand which template files(or functions) are affecting a display so they can be customized ?
They're called theme suggestions. Devel themer module shows all the suggestions in order, including tpl and theme functions, and which one was used, within the rendered page.
Note. It does this by modifying the DOM so it's good to switch it on when you need it then turn it off.
https://www.drupal.org/project/devel_themer
You'll also need the Devel module and simpledom API.
You can read more about the priority of suggestions here. https://www.drupal.org/node/1089656
As @Gulok mentions, as of Drupal 7.33 you can enable theme debugging in your settings file which puts the theme suggestions in to your HTML as comments. Just add $conf["theme_debug"] = TRUE;
in your settings.php. Read more about that here https://www.drupal.org/node/223440#theme-debug
You can also get the theme suggestions in code and modify them, injecting your own suggestions, or completely replacing theme.
Get theme suggestions: https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_get_suggestions/7
First, you can easily debug everything with Devel
module. Another trick that I use to inspect what tpl
is generating a particular element is by adding $conf['theme_debug'] = TRUE;
in settings.php
. After adding that refresh your page (or clear your cache first) then use inspect element. The tpl
should be visible now in the HTML source
. See the screenshot below.
Here is a blog that describe on how to theme a field.
Hoe that helps.
rename the templates, or make backup and delete the file or part of the code (functions). Then refresh your page to see what gets affected.