Ejemplo n.º 1
0
 /**
  * Proxies factory create call for additional fields to specific responsible builder.
  * @param array $settings
  * @return \Phalcon\Forms\ElementInterface form element instance
  * @throws \Vegas\Forms\Builder\Exception\NotFoundException When a specific type is not found
  */
 private function callAdditionalOptionsMethod($item)
 {
     $settings = new InputSettingsForm();
     if (!$settings->isValid($item)) {
         throw new InvalidInputSettingsException();
     }
     $settings->bind($item, new \stdClass());
     $className = $item[InputSettingsForm::TYPE_PARAM];
     if (!class_exists($className)) {
         throw new NotFoundException();
     }
     if (!in_array($className, $this->builders)) {
         throw new NotDefinedException();
     }
     $builderObject = new $className();
     $builderObject->setAdditionalOptions();
     return $builderObject->getAdditionalOptions();
     $setMethod = new \ReflectionMethod($className, self::INIT_ELEMENT_METHOD);
     $getMethod = new \ReflectionMethod($className, self::ADDITIONAL_OPTIONS_METHOD);
     $setMethod->invokeArgs($builderObject, array($settings));
     return $getMethod->invokeArgs($builderObject, array($settings));
 }
Ejemplo n.º 2
0
 /**
  * Default setter for placeholder attribute
  */
 public function setAttributes()
 {
     if ($this->settings->getValue(InputSettings::PLACEHOLDER_PARAM)) {
         $this->element->setAttribute('placeholder', $this->settings->getValue(InputSettings::PLACEHOLDER_PARAM));
     }
 }