You are here

function _hs_content_taxonomy_views_parse_fieldname_from_id in Hierarchical Select 5.3

Given an id of the form "content_taxonomy_<field name>.tid", get the field name.

Return value

When no valid id was given, FALSE, otherwise the field name.

2 calls to _hs_content_taxonomy_views_parse_fieldname_from_id()
hs_content_taxonomy_views_form_alter in modules/hs_content_taxonomy_views.module
Implementation of hook_form_alter().
hs_content_taxonomy_views_hierarchical_select_config_info in modules/hs_content_taxonomy_views.module
Implementation of hook_hierarchical_select_config_info().

File

modules/hs_content_taxonomy_views.module, line 449
Implementation of the Hierarchical Select API for the Content Taxonomy Views module.

Code

function _hs_content_taxonomy_views_parse_fieldname_from_id($id) {
  $field_name = FALSE;

  // When "save as tag": content_taxonomy_field_<field_name>.tid
  // Other save options: content_field_<field_name>.<field_name>_value
  if (preg_match("/(content|content_taxonomy)_(field_[A-Za-z0-9_]+)\\.(\\2_value|tid)/", $id, $matches)) {
    $field_name = $matches[2];
  }
  return $field_name;
}