示例#1
0
 /**
  *
  * {@inheritdoc}
  *
  */
 public function getChoiceList(FieldType $fieldType, array $choices)
 {
     /**@var ObjectPickerType $objectPickerType*/
     $objectPickerType = $this->registry->getType(ObjectPickerType::class)->getInnerType();
     /**@var ObjectChoiceLoader $loader */
     $loader = $objectPickerType->getChoiceListFactory()->createLoader($fieldType->getDisplayOptions()['type'], true);
     $all = $loader->loadAll();
     if (count($choices) > 0) {
         foreach ($all as $key => $data) {
             if (!in_array($key, $choices)) {
                 unset($all[$key]);
             }
         }
         // 			return $loader->loadChoiceList()->loadChoices($choices);
     }
     return $all;
 }