You are here

function _hs_content_taxonomy_parse_context_from_url in Hierarchical Select 5.3

Same name and namespace in other branches
  1. 6.3 modules/hs_content_taxonomy.module \_hs_content_taxonomy_parse_context_from_url()

Parse the context (the content type and the field name) from the URL.

Return value

  • FALSE if no context could be found
  • array($content_type_name, $field_name) otherwise
2 calls to _hs_content_taxonomy_parse_context_from_url()
hs_content_taxonomy_menu in modules/hs_content_taxonomy.module
Implementation of hook_menu().
hs_content_taxonomy_widget_settings in modules/hs_content_taxonomy.module
Implementation of hook_widget_settings().

File

modules/hs_content_taxonomy.module, line 586
Implementation of the Hierarchical Select API for the Content Taxonomy module.

Code

function _hs_content_taxonomy_parse_context_from_url() {
  if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'types') {
    $content_type = content_types(arg(3));
    $type = node_get_types('types', $content_type['type']);
    $field_name = arg(5);
    if (arg(4) == 'fields' && !empty($field_name) && isset($content_type['fields'][$field_name])) {
      if ($content_type['fields'][$field_name]['type'] == 'content_taxonomy' && $content_type['fields'][$field_name]['widget']['type'] == 'content_taxonomy_hs') {
        return array(
          $content_type['type'],
          $field_name,
        );
      }
    }
  }
  return FALSE;
}