You are here

function panopoly_widgets_ctools_content_subtype_alter in Panopoly Widgets 7

Implementation of hook_ctools_content_subtype_alter()

File

./panopoly_widgets.module, line 116

Code

function panopoly_widgets_ctools_content_subtype_alter(&$subtype, &$plugin) {

  // Modify the menu block plugin to better fit into our UI
  if ($plugin['module'] == 'menu_block' && $subtype['menu_title'] == 'Main menu') {
    $subtype['category'][0] = t('Custom');
    $subtype['top level'] = TRUE;
    $subtype['title'] = t('Add submenu');
    $subtype['icon'] = drupal_get_path('module', 'panopoly_widgets') . '/images/icon_submenu.png';
    $subtype['admin css'] = array(
      drupal_get_path('module', 'menu_block') . '/menu-block-admin.css',
    );
    $subtype['admin js'] = array(
      drupal_get_path('module', 'menu_block') . '/menu-block.js',
    );
    $subtype['defaults']['expanded_max_depth'] = 0;
  }

  // Modify the general content item to appear in the generic content sidebar area
  if ($plugin['module'] == 'views_content' && $subtype['title'] == 'Piece of Content') {
    $subtype['category'][0] = t('Custom');
    $subtype['top level'] = TRUE;
    $subtype['title'] = t('Add content item');
    $subtype['icon'] = drupal_get_path('module', 'panopoly_widgets') . '/images/icon_content_item.png';
  }

  // Modify the general content listing to appear in the generic content sidebar area
  if ($plugin['module'] == 'views_content' && $subtype['title'] == 'List of Content') {
    $subtype['category'][0] = t('Custom');
    $subtype['top level'] = TRUE;
    $subtype['title'] = t('Add content list');
    $subtype['icon'] = drupal_get_path('module', 'panopoly_widgets') . '/images/icon_content_list.png';
  }

  // Modify the plugins so we do away with this "node" and "entity" thing
  if ($subtype['category'] == 'Node' || $subtype['category'] == 'Entity') {
    $subtype['category'] = t('Page Content');
  }
  if ($subtype['category'] == 'User') {
    $subtype['category'] = t('User Content');
  }
  if ($subtype['category'] == 'Taxonomy_term' || $subtype['category'] == 'Taxonomy term') {
    $subtype['category'] = t('Category Content');
  }

  // Modify the plugins so we have consistent language around "form" content
  if ($subtype['category'] == 'Form') {
    $subtype['category'] = t('Form Content');
  }
}