Skip to content

Commit

Permalink
Merge branch 'release/1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
kayalion committed May 16, 2017
2 parents 08272e3 + 5228019 commit 326718e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
# [1.5.0]
## Added
- support for seconds field
## Updated
- fixed widget option not read from property field

# [1.4.0]
## Added
- added scaffold form component option
Expand Down
24 changes: 14 additions & 10 deletions src/ride/web/orm/form/ScaffoldComponent.php
Expand Up @@ -484,6 +484,10 @@ protected function addPropertyRow(FormBuilder $builder, ModelField $field, $labe
$rowOptions['component'] = new DateTimeComponent();
} elseif ($type == 'date') {
$rowOptions['round'] = true;
} elseif ($type == 'seconds') {
$type = 'time';
$rowOptions['seconds'] = true;
$rowOptions['hours'] = false;
} elseif ($type == 'label') {
$decorator = $field->getOption('scaffold.form.decorator');
if ($decorator) {
Expand Down Expand Up @@ -579,17 +583,25 @@ protected function addPropertyRow(FormBuilder $builder, ModelField $field, $labe
protected function addOptionRow(FormBuilder $builder, ModelField $field, $label, $description, array $filters, array $validators, array $options, $type) {
$options = $this->ormService->getFieldInputOptions($this->model, $field, $options['translator'], $options['data']);

if ($type == 'object') {
$widget = 'option';
} else {
$widget = $type;
}
$widget = $field->getOption('scaffold.form.widget', $widget);

$rowOptions = array(
'label' => $label,
'description' => $description,
'options' => $options,
'attributes' => array(
'data-toggle-dependant' => 'option-' . $field->getName(),
),
'multiple' => $field instanceof HasManyField,
'localized' => $field->isLocalized(),
'filters' => $filters,
'validators' => $validators,
'widget' => 'option',
'widget' => $widget,
);

$fieldDependency = $this->getFieldDependency($field);
Expand All @@ -598,19 +610,11 @@ protected function addOptionRow(FormBuilder $builder, ModelField $field, $label,
}

if (!$field instanceof PropertyField) {
if ($type == 'object') {
$type = null;
}
$this->proxy[$field->getName()] = true;

$rowOptions['widget'] = $field->getOption('scaffold.form.widget', $type);
$rowOptions['multiple'] = $field instanceof HasManyField;
$rowOptions['order'] = $rowOptions['multiple'] && $field->isOrdered();

$type = 'option';

$this->proxy[$field->getName()] = true;
} else {
$rowOptions['multiple'] = false;
}

if (!$rowOptions['multiple'] && $rowOptions['widget'] != 'option') {
Expand Down

0 comments on commit 326718e

Please sign in to comment.