/** * @return array */ public function getTypes() { $types = $this->typeConfig->getTypes($this->relationInstance->getEntityCode()); $options = []; foreach ($types as $key => $settings) { $options[$key] = __($settings['label']); } return $options; }
/** * get type options as array to use in a select * * @param bool $withEmpty * @return array */ public function toOptionArray($withEmpty = false) { if (is_null($this->options)) { $types = $this->typeConfig->getTypes($this->entityModel->getEntityCode()); $this->options = []; foreach ($types as $type) { $this->options[] = ['value' => $type['id'], 'label' => $type['label']]; } } $options = $this->options; if ($withEmpty) { array_unshift($options, ['value' => '', 'label' => __('Select Entity Type')]); } return $options; }