فهرست منبع

Merge pull request #498 from studip101/master

Fixed Two Minor Bugs in ShowMapper
Thomas 13 سال پیش
والد
کامیت
0f0d89de67
2فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  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);