home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (legacy.inc)

This example Drupal source code file (legacy.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

args, array, call_user_func_array, foreach, function, if, method, panelslegacystate, php, return, strtolower, this, translate, variable

The legacy.inc Drupal example source code

<?php

/**
 * Legacy state manager for Panels.
 *
 * Checks all possible ways (using discovery of patterned method names) in which
 * Panels may need to operate in legacy mode,
 * sets variables as appropriate, and returns an informational
 *
 */
class PanelsLegacyState {
  var $legacy = NULL;

  function t() {
    $func = get_t();
    $args = func_get_args();
    return call_user_func_array($func, $args);
  }

  function getStatus() {
    if (!isset($this->legacy)) {
      $this->determineStatus();
    }
    return $this->legacy;
  }

  /**
   * Run all compatibility checks.
   */
  function determineStatus() {
    $this->legacy = array();
    foreach(get_class_methods($this) as $method) {
      if (strtolower(substr($method, 0, 5)) == 'check') {
        $this->legacy[$method] = $this->$method();
      }
    }
    $this->legacy = array_filter($this->legacy);
  }

  // At this time there are no legacy checks.
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal legacy.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.