You are here

function hierarchical_select_admin_implementations in Hierarchical Select 6.3

Same name and namespace in other branches
  1. 5.3 hierarchical_select.admin.inc \hierarchical_select_admin_implementations()
  2. 7.3 hierarchical_select.admin.inc \hierarchical_select_admin_implementations()

Menu callback; a table that lists all Hierarchical Select implementations and the features they support.

1 string reference to 'hierarchical_select_admin_implementations'
hierarchical_select_menu in ./hierarchical_select.module
Implementation of hook_menu().

File

./hierarchical_select.admin.inc, line 108
Module settings and configuration administration UI.

Code

function hierarchical_select_admin_implementations() {
  $output = '';
  $header = array(
    t('Implementation (module)'),
    t('Hierarchy type'),
    t('Entity type'),
    t('Create new items'),
    t('Entity count'),
  );

  // Retrieve all information items
  $rows = array();
  foreach (module_implements('hierarchical_select_root_level') as $module) {
    $filename = db_result(db_query("SELECT filename FROM {system} WHERE type = 'module' AND name = '%s'", $module));
    $module_info = drupal_parse_info_file(dirname($filename) . "/{$module}.info");

    // Try to extract the hierarchy type from the optional hook_hierarchical_select_config_info().
    $hierarchy_type = $entity_type = t('unknown');
    if (module_hook($module, 'hierarchical_select_implementation_info')) {
      $implementation = module_invoke($module, 'hierarchical_select_implementation_info');
      $hierarchy_type = $implementation['hierarchy type'];
      $entity_type = $implementation['entity type'];
    }
    $rows[] = array(
      $module_info['name'],
      $hierarchy_type,
      $entity_type,
      module_hook($module, 'hierarchical_select_create_item') ? t('Yes') : t('No'),
      module_hook($module, 'hierarchical_select_entity_count') ? t('Yes') : t('No'),
    );
  }
  $output .= '<p>';
  $output .= t('
    The table below allows you to find out <strong>which Hierarchical Select
    features are supported</strong> by the implementations of the Hierarchical
    Select API.<br />
    It is <strong>not a reflection of some settings</strong>.
  ');
  $output .= '</p>';
  $output .= theme('table', $header, $rows, array(), t('Overview of all installed Hierarchical Select implementations.'));
  return $output;
}