Ejemplo n.º 1
0
 public function getEntryDisplayName(AssociationControl $control, Entry $entry)
 {
     // Do we have a custom display mask? If so, we try to use that
     if ($control->getAssociationEntityLabelMask()) {
         try {
             return preg_replace_callback('/%(.*?)%/i', function ($matches) use($entry) {
                 return $entry->getAttribute($matches[1]);
             }, $control->getAssociationEntityLabelMask());
         } catch (\Exception $e) {
         }
     }
     $targetEntity = $this->association->getTargetEntity();
     $attribute = $targetEntity->getAttributes()[0];
     if (is_object($attribute)) {
         return $entry->getAttribute($attribute);
     }
 }