Quantcast
Channel: Arnelbornales's Blog » arnelbornales
Viewing all articles
Browse latest Browse all 10

how to override a specific output in drupal

$
0
0

Finding a hard time how to override a specific output in drupal?

well, there’s a way how to do that

for example, we will override the country field in addresses module

located in address/address.inc

here’s the function:


function theme_addresses_field_country_name($afields) {
$countries = _addresses_country_get();
return '<dt>'. t('Country') .': </dt><dd>'. $countries[$afields['country']] .'</dd>';
}

what we will do is actually we will override this throug our template.php file

we take acquai_marina for this

function acquai_marina_addresses_field_country_name($afields) {
$countries = _addresses_country_get();
return $countries[$afields['country']];
}

or

function phptemplate_addresses_field_country_name($afields) {
$countries = _addresses_country_get();
return $countries[$afields['country']];
}

There we remove the extra tags to for country field

As you can see, we replace the string/text from “theme” to “acquia_marina”/”phptemplate”.

don’t be confused about “acquia_marina” or “phptemplate”  because they behave the same.

This snippet works with hook_theme() or theme_YOURMODULE() override.



Viewing all articles
Browse latest Browse all 10

Trending Articles