Skip to content

Commit

Permalink
usage of getFields() and fix Card (#892)
Browse files Browse the repository at this point in the history
* fix card getfields filter

* Apply fixes from StyleCI

* we should show also integer values for example
  • Loading branch information
DarkSide666 authored Jan 28, 2020
1 parent 9d16ea8 commit 678a301
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
9 changes: 1 addition & 8 deletions src/ActionExecutor/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ public function initPreview()
*/
protected function getModelFields(Model $model)
{
$fields = [];
foreach ($model->getFields() as $f) {
if ($f->isEditable() || $f->isVisible()) {
$fields[] = $f->short_name;
}
}

return $fields;
return array_keys($model->getFields(['editable', 'visible']));
}
}
2 changes: 1 addition & 1 deletion src/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function setModel(Model $m, $fields = null)
}

if (!$fields) {
$fields = array_keys($this->model->getFields('visible'));
$fields = array_keys($this->model->getFields(['editable', 'visible']));
}

$this->setDataId($this->model->get($this->model->id_field));
Expand Down
2 changes: 1 addition & 1 deletion src/CardSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function addDescription($description)
{
$view = null;

if (is_string($description)) {
if (is_scalar($description)) {
$view = $this->add(new View([$description, 'class' => ['description']]));
} elseif ($description instanceof View) {
$view = $this->add($description)->addClass('description');
Expand Down

0 comments on commit 678a301

Please sign in to comment.