Drupal 7 is organised by function. Cel is object oriented and provides additional functions for easy use in Drupal. This page lists the functions for Drupal, the classes for use everywhere, then the methods (functions) available in the classes.
cel()
The cel() function is the easiest way to retrieve a cel in Drupal. You get the template text from cel new registration email
using the following statement.$template= cel('new registration email');
Internally cel() uses the cel_list() function to access the cel_list object then returns the cel text from cel_list.
If you want to convert direct to object orientation, you can bypass cel() and use cel_list.
cel_list()
The cel_list() function is the easiest way to retrieve multiple cels in Drupal. You get the cel_list object from cel_list() then get your cels direct from the object. You get the template for the new registration email
using the following statements.$cel_list= cel_list();
$template= cel_list->cel('new registration email');
There is little advantage for on cel. You get a bigger advantage, a reduced function call overhead, when you access multiple cels, as shown in the following code.
$cel_list= cel_list();
$templates_required = array('a', 'b', 'd', 'z');
$templates_found = array();
foreach($templates_required as $id)
{
$templates_found[$id]= cel_list->cel($id);
}
The Cel classes section shows you how to use the cel and cel_list objects direct in your code.
cel_replace()
The cel() function is an easy way to retrieve a cel in Drupal and may feed into token_replace(), from the Token module. cel_repalce() combines the two. The following code shows the two functions used together.$text = cel('example')->cel();
$result = token_replace($text);
The following code shows the two functions combined as one.$result = cel_replace('example');









- Facebook Like
- Google Plus One
- Log in or register to post comments