Skip to content

Commit

Permalink
properly display field presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrián Pardellas Blunier committed Jul 12, 2016
1 parent 59bc141 commit 1ebb565
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Abstractor/Eloquent/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function presentation()

$nameWithSpaces = str_replace('_', ' ', $this->name);
$namePieces = explode(' ', $nameWithSpaces);
$namePieces = array_map('trim', $namePieces);
$namePieces = array_filter(array_map('trim', $namePieces));

return ucfirst(transcrud(implode(' ', $namePieces)));
}
Expand Down
11 changes: 9 additions & 2 deletions src/Abstractor/Eloquent/FieldFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,14 @@ protected function getFormElement()

public function getPresentation()
{
return transcrud($this->config['presentation']) ? : ucfirst(str_replace('_', ' ',
transcrud($this->config['name'])));
if ($this->config['presentation']) {
return transcrud($this->config['presentation']);
}

$nameWithSpaces = str_replace('_', ' ', $this->config['name']);
$namePieces = explode(' ', $nameWithSpaces);
$namePieces = array_filter(array_map('trim', $namePieces));

return ucfirst(transcrud(implode(' ', $namePieces)));
}
}

0 comments on commit 1ebb565

Please sign in to comment.