Add chain to form

@param string      $name

@return ValidatorChain
516858
public function add($name): ValidatorChain
    {
        $this->validators[$name] = $this->validators[$name] ?? Validator::create();
        return $this->validators[$name];
    }
184935
private function addChainNode()
    {
        $builder = new TreeBuilder('chain');
        $node    = $this->getRootNode($builder, 'chain');

        $node
            ->fixXmlConfig('provider')
            ->children()
                ->arrayNode('providers')
                    ->prototype('scalar')->end()
                ->end()
            ->end()
        ;

        return $node;
    }
1324461
function add($name, $container = null) {
        $method = \Str::studly('add_' . $name);
        if (!$container) {
            $container = $this->form;
        }

        $element = call_user_func([
            $this,
            $method
        ], $container);
        /* @var ElementTbText $element */
        $element->toggleFrozen(!$this->isFieldEnabled($name));
        if (!$element->getLabel()) {
            $element->setLabel($this->model->getEntityLabel($name));
        }
        return $element;
    }
654864
public function addAttachment($file, $name = null)
    {
        $this->_attachments[] = ['file' => $file, 'name' => $name ?: basename($file)];
        return $this;
    }
1103907
public function createValidator(string $name): ValidatorInterface
    {
        if (isset($this->validators[$name])) {
            return $this->validators[$name];
        }

        if (($validator = $this->getValidatorDefine($name)) !== false) {
            if (Assert::string($validator)) {
                if (Assert::namespace($validator)) {
                    $namespace = $validator;
                } else {
                    $namespace = '\\One\\Validation\\Validators\\' . $validator;
                }

                $this->validators[$name] = Reflection::newInstance(
                    $namespace,
                    [ $this ]
                );

                unset($namespace);
            } elseif (Assert::array($validator)) {
                $this->validators[$name] = CustomValidator::createFromArray($this, $validator);
            } else {
                $this->validators[$name] = CustomValidator::createFromClosure($this, $validator);
            }

            return $this->validators[$name];
        }

        throw new ValidationException(sprintf('Validator "%s" not found', $name));
    }
493867
public function createCheck($constraint, $name = null)
    {
        $check = new Check($name, $constraint);
        $this->addCheck($check);

        return $check;
    }
1016532
public function actionView($name)
    {
        $formModel = new AddAuthItemForm();

        /* @var $am CAuthManager|AuthBehavior */
        $am = Yii::app()->getAuthManager();

        if (isset($_POST['AddAuthItemForm'])) {
            $formModel->attributes = $_POST['AddAuthItemForm'];
            if ($formModel->validate()) {
                if (!$am->hasItemChild($name, $formModel->items)) {
                    $am->addItemChild($name, $formModel->items);
                    if ($am instanceof CPhpAuthManager) {
                        $am->save();
                    }
                }
            }
        }

        $item = $am->getAuthItem($name);

        $dpConfig = array(
            'pagination' => false,
            'sort' => array('defaultOrder' => 'depth asc'),
        );

        $ancestors = $am->getAncestors($name);
        $ancestorDp = new PermissionDataProvider(array_values($ancestors), $dpConfig);

        $descendants = $am->getDescendants($name);
        $descendantDp = new PermissionDataProvider(array_values($descendants), $dpConfig);

        $childOptions = $this->getItemChildOptions($item->name);
        if (!empty($childOptions)) {
            $childOptions = array_merge(array('' => Yii::t('AuthModule.main', 'Select item') . ' ...'), $childOptions);
        }

        $this->render(
            'view',
            array(
                'item' => $item,
                'ancestorDp' => $ancestorDp,
                'descendantDp' => $descendantDp,
                'formModel' => $formModel,
                'childOptions' => $childOptions,
            )
        );
    }
316154
public function addBcc($mail, $name = null)
    {
        $mail = ($name !== null) ? (ucwords($name) . " <{$mail}>") : $mail;

        $this->headers[] = "Bcc: $mail";

        return $this;
    }
1187364
public function addInputPassword(string $name) : Element\Input\Password
    {
        $input = new Element\Input\Password($this, $name);
        $this->addComponent($name, $input);

        return $input;
    }
415629
public function add(string $name, callable $callback): \IvoPetkov\BearFrameworkAddons\ServerRequests
    {
        $this->callbacks[$name] = $callback;
        return $this;
    }
1162467
public function newForm($name, array $definition)
    {
        $container = ContainerBuilder::buildContainer([
            $name => Definition::object('Slick\Form\Form')
                ->constructor([$name])
        ]);

        $this->_form = $container->get($name);

        foreach ($definition as $name => $element) {
            $this->addElement($this->_form, $name, $element);
        }
        return $this->_form;
    }
1371686
public function addInputImage(string $name) : Element\Input\Image
    {
        $input = new Element\Input\Image($this, $name);
        $this->addComponent($name, $input);

        return $input;
    }
476950
public function addLink($name, $label = '', $attr = [] )
    {
        $e = new \FrenchFrogs\Form\Element\Link($name, $label, $attr);
        $this->addElement($e);
        return $e;
    }
869275
protected function createSelectWithConstraint($name)
    {
        return [explode(':', $name)[0], function ($query) use ($name) {
            $query->select(explode(',', explode(':', $name)[1]));
        }];
    }
1336046
public function addInputFile(string $name) : Element\Input\File
    {
        $this->setEnctypeMultipart();

        $input = new Element\Input\File($this, $name);
        $this->addComponent($name, $input);

        return $input;
    }
1338622
public function addField(string $name) : self
    {
        // Generate field name
        $field_name = 'field_' . bin2hex(random_bytes(16));
        if (substr($name, -2) === '[]') {
            $field_name .= '[]';
        }

        // Field key must be unique
        if (isset($_SESSION[$this->key][$field_name])) {
            return $this->addField($name);
        }

        // Remove square brackets from original key (moved to generated key few lines above)
        if (substr($name, -2) === '[]') {
            $name = substr($name, 0, -2);
        }

        // Save
        $_SESSION[$this->key][$field_name] = trim($name);
        return $this;
    }
546161
public function addClass($name)
    {
        foreach ($this as $node) {
            if ($node instanceof \DOMElement) {
                /** @var \DOMElement $node */
                $classes = preg_split('/\s+/s', $node->getAttribute('class'));
                $found = false;
                $count = count($classes);
                for ($i = 0; $i < $count; $i++) {
                    if ($classes[$i] == $name) {
                        $found = true;
                    }
                }
                if (!$found) {
                    $classes[] = $name;
                    $node->setAttribute('class', trim(join(' ', $classes)));
                }
            }
        }
        return $this;
    }