/**
  * Prepare collection for prototype by adding prototype as child
  * @param FormField $field
  */
 public function preparePrototype(FormField $field)
 {
     if (!$field->getOption('is_prototype')) {
         throw new \InvalidArgumentException('Field [' . $field->getRealName() . '] is not a valid prototype object.');
     }
     $this->children = [];
     $this->children[] = $field;
 }
Пример #2
0
 /**
  * Get the title, used for validating a rule
  *
  * @param  string $rule
  * @param  array  $params
  * @return string
  */
 protected function getTitle($rule, $params = array())
 {
     $params['attribute'] = $this->field->getOption('label');
     return $this->formHelper->getTranslator()->trans('validation.' . $rule, $params);
 }