コード例 #1
0
ファイル: Relation.php プロジェクト: artmouse/Umc_Base
 /**
  * @return array
  */
 public function getTypes()
 {
     $types = $this->typeConfig->getTypes($this->relationInstance->getEntityCode());
     $options = [];
     foreach ($types as $key => $settings) {
         $options[$key] = __($settings['label']);
     }
     return $options;
 }
コード例 #2
0
ファイル: Type.php プロジェクト: artmouse/Umc_Base
 /**
  * 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;
 }