You are here

function panels_mini_content_types in Panels 5.2

Same name and namespace in other branches
  1. 6.2 panels_mini/panels_mini.module \panels_mini_content_types()

Return each available mini panel available as a subtype.

1 string reference to 'panels_mini_content_types'
panels_mini_panels_content_types in panels_mini/panels_mini.module
Expose all mini panels to our own system.

File

panels_mini/panels_mini.module, line 855
panels_mini.module

Code

function panels_mini_content_types() {
  $types = array();
  foreach (panels_mini_load_all() as $mini) {
    if (!empty($mini->disabled)) {
      continue;
    }
    $types[$mini->name] = array(
      'title' => filter_xss_admin($mini->title),
      // For now mini panels will just use the contrib block icon.
      'icon' => 'icon_contrib_block.png',
      'path' => panels_get_path("content_types/block"),
      'description' => filter_xss_admin($mini->title),
      'category' => array(
        !empty($mini->category) ? filter_xss_admin($mini->category) : t('Mini panel'),
        -8,
      ),
    );
    if (!empty($mini->requiredcontexts)) {
      $types[$mini->name]['required context'] = array();
      foreach ($mini->requiredcontexts as $context) {
        $info = panels_get_context($context['name']);

        // TODO: allow an optional setting
        $types[$mini->name]['required context'][] = new panels_required_context($context['identifier'], $info['context name']);
      }
    }
  }
  return $types;
}