Skip to content

Commit

Permalink
Fixed an undefined property in some edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Sep 25, 2019
1 parent 0286bc7 commit d62dfd2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Configuration/ViewConfigPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ private function processFieldConfig(array $backendConfig)
foreach ($backendConfig['entities'] as $entityName => $entityConfig) {
foreach (['edit', 'list', 'new', 'search', 'show'] as $view) {
foreach ($entityConfig[$view]['fields'] as $fieldName => $fieldConfig) {
if (!isset($fieldConfig['label']) && 'id' === $fieldConfig['property']) {
if (!isset($fieldConfig['label']) && isset($fieldConfig['property']) && 'id' === $fieldConfig['property']) {
// if the field is called 'id' and doesn't define a custom label, use 'ID' as label to
// improve the readability of the label, which is usually related to a primary key
$fieldConfig['label'] = 'ID';
} elseif (isset($fieldConfig['label']) && false === $fieldConfig['label']) {
// if the label is the special value 'false', label must be hidden (use an empty string as the label)
$fieldConfig['label'] = '';
$fieldConfig['sortable'] = false;
} elseif (null === $fieldConfig['label'] && 0 !== strpos($fieldConfig['property'], '_easyadmin_form_design_element_')) {
} elseif (null === $fieldConfig['label'] && isset($fieldConfig['property']) && 0 !== strpos($fieldConfig['property'], '_easyadmin_form_design_element_')) {
// else, generate the label automatically from its name (except if it's a
// special element created to render complex forms)
$fieldConfig['label'] = $this->humanize($fieldConfig['property']);
Expand Down

0 comments on commit d62dfd2

Please sign in to comment.