You are here

function ds_ctools_get_category in Display Suite 7

Same name and namespace in other branches
  1. 7.2 includes/ds.field_ui.inc \ds_ctools_get_category()

Helper function to get the category.

1 call to ds_ctools_get_category()
ds_ctools_content_select in ./ds.field_ui.inc
Select content.

File

./ds.field_ui.inc, line 1120
Field UI functions for Display Suite.

Code

function ds_ctools_get_category($content_type) {
  if (isset($content_type['top level'])) {
    $category = 'root';
  }
  elseif (isset($content_type['category'])) {
    if (is_array($content_type['category'])) {
      list($category, $weight) = $content_type['category'];
    }
    else {
      $category = $content_type['category'];
    }
  }
  else {
    $category = t('Uncategorized');
  }
  return array(
    preg_replace('/[^a-z0-9]/', '-', drupal_strtolower($category)),
    $category,
  );
}