DRUPAL : Identifying Themeable Functions

Identifying Themeable Functions
There is no automated tool for the identification of the various themeable functions in Drupal. You can, however, identify them by their names, because all themeable functions employ a consistent naming convention. Themeable functions’ names all begin with theme_ and they are located in the modules and includes directories. The naming convention makes it possible to work your way through the various files to isolate all the functions. You can ease the pain somewhat by setting up Dreamweaver or a similar program to do the searching for you.
Additionally, you can use the following snippet of PHP code from within Drupal to produce a list of the active functions on your installation.

  • <?php
  •   print ‘<ol>’;
  •   $functions = get_defined_functions();
  •   foreach($functions[‘user’] as $function) {
  •     if(substr($function,0,6)== ‘theme_’)
  •   print « <li>$function</li> »;
  •   }
  • print ‘</ol>’;
  • ?>

To use this code, first create a new Block within your site. Set the input option for the Block to PHP, and then insert the code into the Block body. Give your new utility Block an easy-to-remember name, save it, then assign it to some where you can view the output.
The new Block will print on the screen a list of all the active themeable functions in your system. The snippet is useful but limited; unfortunately, it will not tell you which files to look in to find the functions or exactly what they do.

Blogged with the Flock Browser



Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion /  Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )


Connexion à %s

%d blogueurs aiment cette page :