Prechádzať zdrojové kódy

Add getLabel() to FieldDescriptionInterface; call it from ShowMapper

ShowMapper type hints $name on FieldDescriptionInterface, so the method
should be there.
Ethan Resnick 13 rokov pred
rodič
commit
22ee95ecc0

+ 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'));
         }