Exemple #1
0
 /**
  * @param string $name
  * @param string $title
  *
  * @throws ArgumentTypeException
  */
 function __construct($name, $title = '')
 {
     $this->attrs = new NamedObjectList([KeyValuePair::getClass()]);
     $this->children = new NamedObjectList([Block::getClass(), AbstractField::getClass()]);
     parent::__construct($name);
     $this->title($title);
     $this->isValid = true;
     $this->templateName = self::DEFAULT_TEMPLATE;
 }
Exemple #2
0
<?php

/**
 * User: Ionov George
 * Date: 17.03.2016
 * Time: 9:06
 */
return ['renderer' => ['templates' => ['default' => ['form' => '{result}{errors}{label}<div>{start}{children}{handlers}{end}</div>{scripts}', 'block' => '{label}<div>{children}</div>', 'field' => '<div><label {forField}>{title}</label>{field}</div>{errors}', 'handler' => '<div>{handler}</div>', 'errors' => ['default' => '<span>{errorsStr}</span>', 'form' => '<div>{errorsStr}</div>'], 'label' => ['default' => '<span>{title}</span>', 'form' => '<div>{title}</div>'], 'result' => '<div class="{className}">{message}</div>', 'checkSet' => '{label}<div>{options}</div>{errors}', 'checkSetOption' => '<span><label>{optionTitle}{option}</label></span>', 'repeatFiled' => '<div {blockSelector}>{field}{actions}{errors}</div>', 'repeatBlock' => '<div {blockSelector}>{children}{actions}</div>', 'repeatContainer' => '<div {containerSelector}>{label}{children}</div>{repeatScript}', 'repeatActionsBlock' => '<div {actionsBlockSelector}="{name}">{deleteButton}{addButton}</div>', 'deleteButton' => '<span {deleteActionSelector}>-</span>', 'addButton' => '<span {addActionSelector}>+</span>', 'attribute' => '{name}="{value}"', 'shortAttribute' => '{name}']], 'repeat' => ['block' => 'data-repeat-block', 'container' => 'data-repeat-container', 'actionsBlock' => 'data-repeat-actions', 'deleteAction' => 'data-delete', 'addAction' => 'data-add'], 'errors' => ['delimiter' => '<br>'], 'alias' => [\NewInventor\Form\Form::getClass() => 'form', \NewInventor\Form\Block::getClass() => 'block', \NewInventor\Form\Field\AbstractField::getClass() => 'field', \NewInventor\Form\Handler::getClass() => 'handler']], 'validator' => ['email' => \NewInventor\Form\Validator\Validators\EmailValidator::getClass(), 'integer' => \NewInventor\Form\Validator\Validators\IntegerValidator::getClass(), 'string' => \NewInventor\Form\Validator\Validators\StringValidator::getClass(), 'required' => \NewInventor\Form\Validator\Validators\RequiredValidator::getClass()]];
Exemple #3
0
 /**
  * @inheritdoc
  */
 public function load($data = null)
 {
     $status = $this->getStatus();
     if ($status == self::STATUS_SHOW_RESULT || $status == self::STATUS_NORMAL) {
         $this->beforeSave();
     }
     if ($status == self::STATUS_BEFORE_REDIRECT) {
         $this->afterRefresh();
     }
     return parent::load($data);
 }
Exemple #4
0
 /**
  * @inheritdoc
  */
 public function repeatable($object)
 {
     TypeChecker::getInstance()->check($object, [Block::getClass(), AbstractField::getClass()], 'object')->throwTypeErrorIfNotValid();
     $repeatableBlockName = $object->getName();
     $repeatableBlockTitle = $object->getTitle();
     $object->title('');
     $repeatableBlock = new Block($repeatableBlockName, $repeatableBlockTitle);
     $repeatableBlock->setRepeatable(true);
     $object->setName('#IND#');
     $repeatableBlock->setRepeatObject($object);
     $deepCopy = new DeepCopy();
     $objectClone = $deepCopy->copy($repeatableBlock->getRepeatObject());
     $objectClone->setParent($repeatableBlock);
     $objectClone->setName('0');
     $repeatableBlock->children()->add($objectClone);
     $repeatableBlock->setParent($this);
     $this->children()->add($repeatableBlock);
     return $this;
 }