Example #1
0
 /**
  * Конструктор
  *
  * @param string|array $options
  */
 public function __construct($options)
 {
     $this->elements = new Core_ArrayObject();
     if (is_string($options)) {
         $path = Gear::preparePath($options);
         if (!($config = Config::read($path))) {
             error(t('Не могу прочитать файл конфигурации формы по адресу <b>%s</b>.', $path));
             $options = $this->options;
         } else {
             $options = $config;
         }
     } else {
         $options = Core_ArrayObject::transform($options);
     }
     parent::__construct(Form::filterOptions($options));
     $this->defaults = new Config(cogear()->form->dir . DS . 'defaults' . EXT);
     $this->init();
     event('form.load', $this);
     event('form.load.' . $this->options->name, $this);
 }