Skip to content

Commit

Permalink
bug #2944 Fixed an undefined property in some edge cases (javiereguiluz)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.0.x-dev branch.

Discussion
----------

Fixed an undefined property in some edge cases

Fixes #2941.

Commits
-------

d62dfd2 Fixed an undefined property in some edge cases
  • Loading branch information
javiereguiluz committed Sep 26, 2019
2 parents 076bff0 + d62dfd2 commit daf1bf2
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 daf1bf2

Please sign in to comment.