Explorar o código

Merge pull request #498 from studip101/master

Fixed Two Minor Bugs in ShowMapper
Thomas %!s(int64=13) %!d(string=hai) anos
pai
achega
0f0d89de67
Modificáronse 2 ficheiros con 10 adicións e 1 borrados
  1. 7 0
      Admin/FieldDescriptionInterface.php
  2. 3 1
      Show/ShowMapper.php

+ 7 - 0
Admin/FieldDescriptionInterface.php

@@ -239,4 +239,11 @@ interface FieldDescriptionInterface
      * @return int|string
      */
     function getMappingType();
+
+    /**
+     * return the label to use for the current field
+     *
+     * @return string
+     */
+    function getLabel();
 }

+ 3 - 1
Show/ShowMapper.php

@@ -55,8 +55,10 @@ class ShowMapper
             $this->with($this->admin->getLabel());
         }
 
+        $fieldKey = ($name instanceof FieldDescriptionInterface) ? $name->getName() : $name;
+
         $formGroups = $this->admin->getShowGroups();
-        $formGroups[$this->currentGroup]['fields'][$name] = $name;
+        $formGroups[$this->currentGroup]['fields'][$fieldKey] = $fieldKey;
         $this->admin->setShowGroups($formGroups);