[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/ctools/ctools_custom_content/ -> ctools_custom_content.module (source)

   1  <?php
   2  // $Id: ctools_custom_content.module,v 1.1.2.2 2010/07/23 21:47:20 merlinofchaos Exp $
   3  
   4  /**
   5   * @file
   6   * ctools_custom_content module
   7   *
   8   * This module allows styles to be created and managed on behalf of modules
   9   * that implement styles.
  10   *
  11   * The ctools_custom_content tool allows recolorable styles to be created via a miniature
  12   * scripting language. Panels utilizes this to allow administrators to add
  13   * styles directly to any panel display.
  14   */
  15  
  16  /**
  17   * Implementation of hook_perm()
  18   */
  19  function ctools_custom_content_perm() {
  20    return array(
  21      'administer custom content',
  22    );
  23  }
  24  
  25  /**
  26   * Implementation of hook_ctools_plugin_directory() to let the system know
  27   * we implement task and task_handler plugins.
  28   */
  29  function ctools_custom_content_ctools_plugin_directory($module, $plugin) {
  30    // Most of this module is implemented as an export ui plugin, and the
  31    // rest is in ctools/includes/ctools_custom_content.inc
  32    if ($module == 'ctools' && $plugin == 'export_ui') {
  33      return 'plugins/' . $plugin;
  34    }
  35  }
  36  
  37  /**
  38   * Create callback for creating a new CTools custom content type.
  39   *
  40   * This ensures we get proper defaults from the plugin for its settings.
  41   */
  42  function ctools_content_type_new($set_defaults) {
  43    $item = ctools_export_new_object('ctools_custom_content', $set_defaults);
  44    ctools_include('content');
  45    $plugin = ctools_get_content_type('custom');
  46    $item->settings = ctools_content_get_defaults($plugin, array());
  47    return $item;
  48  }
  49  
  50  /**
  51   * Implementation of hook_panels_dashboard_blocks().
  52   *
  53   * Adds page information to the Panels dashboard.
  54   */
  55  function ctools_custom_content_panels_dashboard_blocks(&$vars) {
  56    $vars['links']['ctools_custom_content'] = array(
  57      'title' => l(t('Custom content'), 'admin/build/ctools-content/add'),
  58      'description' => t('Custom content panes are basic HTML you enter that can be reused in all of your panels.'),
  59    );
  60  
  61     // Load all mini panels and their displays.
  62    ctools_include('export');
  63    $items = ctools_export_crud_load_all('ctools_custom_content');
  64    $count = 0;
  65    $rows = array();
  66  
  67    foreach ($items as $item) {
  68      $rows[] = array(
  69        check_plain($item->admin_title),
  70        array(
  71          'data' => l(t('Edit'), "admin/build/ctools-content/list/$item->name/edit"),
  72          'class' => 'links',
  73        ),
  74      );
  75  
  76      // Only show 10.
  77      if (++$count >= 10) {
  78        break;
  79      }
  80    }
  81  
  82    if ($rows) {
  83      $content = theme('table', array(), $rows, array('class' => 'panels-manage'));
  84    }
  85    else {
  86      $content = '<p>' . t('There are no custom content panes.') . '</p>';
  87    }
  88  
  89    $vars['blocks']['ctools_custom_content'] = array(
  90      'title' => t('Manage custom content'),
  91      'link' => l(t('Go to list'), 'admin/build/ctools-content'),
  92      'content' => $content,
  93      'class' => 'dashboard-content',
  94      'section' => 'right',
  95    );
  96  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7