You are here

function lineage_strip_weight in Taxonomy Lineage 7

Same name and namespace in other branches
  1. 6 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, or false on error.

1 call to lineage_strip_weight()
views_plugin_style_lineage_nested::render_nesting in plugins/views_plugin_style_lineage_nested.inc
1 string reference to 'lineage_strip_weight'
lineage_handler_field::render in handlers/lineage_handler_field.inc
Render the field.

File

./lineage.module, line 281
lineage.module Module code for taxonomy term hierarchy lineage.

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;
  }
}