function lineage_strip_weight in Taxonomy Lineage 6
Same name and namespace in other branches
- 7 lineage.module \lineage_strip_weight()
Strip the weight from the beginning of a lineage term string.
Parameters
term_string one line of a lineage, with weight:
Return value
one line of a lineage, with the weight removed
1 call to lineage_strip_weight()
1 string reference to 'lineage_strip_weight'
- lineage_handler_field::render in ./
lineage_handler_field.inc - Render the field.
File
- ./
lineage.module, line 235
Code
function lineage_strip_weight($term_string) {
// Remove numbers 0-9 followed by a hyphen, at most once.
$term_name = preg_replace("([0-9]+-)", "", $term_string, 1);
if ($term_name != $term_string) {
return $term_name;
}
else {
// Passed string did not include a proper weight; set a warning.
_lineage_format_warning();
return FALSE;
}
}