Example #1
0
 public static function load($pathname)
 {
     if (!is_array(self::$loaded)) {
         self::$loaded = array();
     }
     if (!is_file($pathname)) {
         throw new FieldException(__('Could not find Field <code>%s</code>. If the Field was provided by an Extension, ensure that it is installed, and enabled.', array(basename($pathname))));
     }
     if (!isset(self::$loaded[$pathname])) {
         self::$loaded[$pathname] = (require $pathname);
     }
     $obj = new self::$loaded[$pathname]();
     $obj->type = preg_replace('%^field\\.|\\.php$%', '', basename($pathname));
     return $obj;
 }