Przeglądaj źródła

Remove duplicate code from Admin and add one more rule for == 'create'

Alexandru Furculita 10 lat temu
rodzic
commit
dbb3f4db88
1 zmienionych plików z 13 dodań i 13 usunięć
  1. 13 13
      Admin/Admin.php

+ 13 - 13
Admin/Admin.php

@@ -2223,21 +2223,21 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
             );
 
             return $childAdmin->buildBreadcrumbs($action, $menu);
-        } elseif ($this->isChild()) {
-            if ($action == 'list') {
-                $menu->setUri(false);
-            } elseif ($action != 'create' && $this->hasSubject()) {
-                $menu = $menu->addChild($this->toString($this->getSubject()));
-            } else {
-                $menu = $menu->addChild(
-                    $this->trans($this->getLabelTranslatorStrategy()->getLabel(sprintf('%s_%s', $this->getClassnameLabel(), $action), 'breadcrumb', 'link'))
-                );
-            }
-        } elseif ($action != 'list' && $this->hasSubject()) {
+        }
+
+        if ($action === 'list' && $this->isChild()) {
+            $menu->setUri(false);
+        } elseif ($action !== 'create' && $this->hasSubject()) {
             $menu = $menu->addChild($this->toString($this->getSubject()));
-        } elseif ($action != 'list') {
+        } else {
             $menu = $menu->addChild(
-                $this->trans($this->getLabelTranslatorStrategy()->getLabel(sprintf('%s_%s', $this->getClassnameLabel(), $action), 'breadcrumb', 'link'))
+                $this->trans(
+                    $this->getLabelTranslatorStrategy()->getLabel(
+                        sprintf('%s_%s', $this->getClassnameLabel(), $action),
+                        'breadcrumb',
+                        'link'
+                    )
+                )
             );
         }