/**
  * @param array       $arguments
  * @param string      $source
  * @param string|null $name
  *
  * @return Field|bool
  */
 public function buildField($arguments, $source, $name = null)
 {
     $params = new FieldParams();
     $params->setParams($arguments);
     $params->setParam('source', $source);
     $params->setParam('name', $params->getParam('name', $name));
     $type = $params->getParam('options.handler', $params->getParam('type'));
     $field = Field::factory($type, $params);
     return $field;
 }
 /**
  * @param string $layout
  *
  * @return string
  */
 public function render($layout = 'edit')
 {
     $column = $this->_params->getParam('name');
     $prefix = $this->_params->getParam('source');
     $fieldId = ($prefix ? $prefix . '_' : '') . $column;
     $fieldName = $prefix ? $prefix . '[' . $column . ']' : $column;
     $defaultParams = $this->_params->getParams();
     unset($defaultParams['name']);
     $tagParams = array_merge([$fieldName], $this->_params->getParam('tag', []), ['value' => $this->getValue(), 'id' => $fieldId] + $defaultParams);
     $this->_params->setParam('id', $fieldId);
     // все параметры уже добавлены, в общем списке они не нужны
     unset($tagParams['tag']);
     $tagParams['class'] = isset($tagParams['class']) ? $tagParams['class'] . ' form-control' : 'form-control';
     $layout = $this->_params->getParam('options.layout', $layout);
     $this->beforeRender($tagParams);
     $this->_view->setLayout($layout);
     $this->_view->setVars(['field' => $this, 'model' => $this->_model, 'params' => $this->_params, 'tag' => $tagParams]);
     return $this->_view->getRender($this->getLayoutDir($layout), $layout);
 }