[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/panels/includes/ -> legacy.inc (source)

   1  <?php
   2  
   3  /**
   4   * Legacy state manager for Panels.
   5   *
   6   * Checks all possible ways (using discovery of patterned method names) in which
   7   * Panels may need to operate in legacy mode,
   8   * sets variables as appropriate, and returns an informational
   9   *
  10   */
  11  class PanelsLegacyState {
  12    var $legacy = NULL;
  13  
  14    function t() {
  15      $func = get_t();
  16      $args = func_get_args();
  17      return call_user_func_array($func, $args);
  18    }
  19  
  20    function getStatus() {
  21      if (!isset($this->legacy)) {
  22        $this->determineStatus();
  23      }
  24      return $this->legacy;
  25    }
  26  
  27    /**
  28     * Run all compatibility checks.
  29     */
  30    function determineStatus() {
  31      $this->legacy = array();
  32      foreach(get_class_methods($this) as $method) {
  33        if (strtolower(substr($method, 0, 5)) == 'check') {
  34          $this->legacy[$method] = $this->$method();
  35        }
  36      }
  37      $this->legacy = array_filter($this->legacy);
  38    }
  39  
  40    /**
  41     * Compatibility checker that ensures modules that implement Panels styles
  42     * list their api as being at least 2.0; this corresponds to the change with
  43     * the initial IPE commit that made region styles take a fully rendered pane
  44     * HTML string instead of a pane object that still needed rendering.
  45     */
  46    function checkStylesIPE1() {
  47      $legacy_info = array(
  48        'explanation' => $this->t('Panels 3.6 made changes to the rendering order in a way that affects certain style plugins. The above modules implement style plugins, but have not indicated their compatibility with this new system. See !link for information on how to update style plugins to the new system.', array('!link' => url('http://drupal.org/node/865840', array('external' => TRUE)))),
  49        'modules' => array(),
  50      );
  51  
  52  
  53      $naughties = &$legacy_info['modules'];
  54      $legacy = FALSE;
  55  
  56      ctools_include('plugins', 'panels');
  57      // TODO given that the plugin cache is also clearing at this time, should
  58      // check this to ensure this isn't causing some kind of weird race condition
  59      $styles = panels_get_styles();
  60  
  61      foreach ($styles as $style) {
  62        if (version_compare($style['version'], 2.0, '<') && empty($naughties[$style['module']])) {
  63          $legacy = TRUE;
  64          $naughties[$style['module']] = $this->t('Style plugins');
  65        }
  66      }
  67      variable_set('panels_legacy_rendering_mode', $legacy);
  68      return $legacy ? $legacy_info : array();
  69    }
  70  }


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