Пример #1
0
 /**
  * @param Field $field
  * @param string $type
  * @return string
  */
 public function buttonField(Field $field, $type = 'button')
 {
     $attributes = $field->getAttributes();
     $attributes['type'] = $type;
     if ($field->label) {
         $value = $field->label;
         $attributes['value'] = $field->value;
     } else {
         $value = $field->value;
     }
     return $this->builder->button($value, $attributes);
 }
Пример #2
0
 /**
  * Render a given field.
  *
  * @param  Field $field
  *
  * @return string
  */
 public function renderField(Field $field)
 {
     $output = '';
     if ($this->fieldNames) {
         $field->addName($this->fieldNames, true);
     }
     if ($_value = array_get($this->fillData, $field->dotName())) {
         $field->value($_value);
     }
     $output .= $this->fire('beforeField', $this, $field);
     if ($field->type == Field::RAW_FIELD_TYPE) {
         $fieldHtml = $field->value;
     } elseif ($this->manager->isMacro($field->type)) {
         $fieldHtml = $this->manager->callMacro($field->type, $field, $this->getRenderer());
     } else {
         $fieldHtml = $this->getRenderer()->field($field);
     }
     $output .= $fieldHtml;
     $output .= $this->fire('afterField', $this, $field);
     return $output;
 }