瀏覽代碼

Add getLabel() to FieldDescriptionInterface; call it from ShowMapper

ShowMapper type hints $name on FieldDescriptionInterface, so the method
should be there.
Ethan Resnick 13 年之前
父節點
當前提交
22ee95ecc0
共有 2 個文件被更改,包括 8 次插入1 次删除
  1. 7 0
      Admin/FieldDescriptionInterface.php
  2. 1 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();
 }

+ 1 - 1
Show/ShowMapper.php

@@ -75,7 +75,7 @@ class ShowMapper
             throw new \RuntimeException('invalid state');
         }
 
-        if (!$fieldDescription->getOption('label')) {
+        if (!$fieldDescription->getLabel()) {
             $fieldDescription->setOption('label', $this->admin->getLabelTranslatorStrategy()->getLabel($fieldDescription->getName(), 'show', 'label'));
         }