diff --git a/ft.entry_type.php b/ft.entry_type.php index 7fad49b..8662fb5 100644 --- a/ft.entry_type.php +++ b/ft.entry_type.php @@ -315,6 +315,16 @@ protected function fieldsByGroup($group_id = false, bool $exclude_field_id = fal */ public function display_settings($settings = []) { + if (!$this->field_id) { + return ['field_options_entry_type' => [ + 'label' => 'field_options', + 'group' => 'entry_type', + 'settings' => [ + 'This field must first be created and assigned to a Field Group or Channel, then edit the field to change it\'s options.' + ] + ]]; + } + ee()->load->library('entry_type'); ee()->load->helper('array'); @@ -327,6 +337,7 @@ public function display_settings($settings = []) } else { $this->field_id = ee()->uri->segment(4); + /** @var CI_DB_result $query */ $query = ee()->db->select('group_id') ->from('channel_field_groups_fields') ->where('field_id', $this->field_id) @@ -362,6 +373,16 @@ public function display_settings($settings = []) $vars['fields'] = $this->fieldsByChannel($this->settings['field_id'], $this->field_id); } + if (empty($vars['fields'])) { + return ['field_options_entry_type' => [ + 'label' => 'field_options', + 'group' => 'entry_type', + 'settings' => [ + 'This field must first be assigned to a Field Group or Channel, then edit the field to change it\'s options.' + ] + ]]; + } + if (empty($settings['type_options'])) { $vars['type_options'] = [ '' => [