/** * Handle the select options. * * @param CheckboxesFieldType $fieldType * @return array */ public function handle(CheckboxesFieldType $fieldType) { $options = array_get($fieldType->getConfig(), 'options', []); if (is_string($options)) { $options = $this->dispatch(new ParseOptions($options)); } return $options; }
/** * Handle the select options. * * @param CheckboxesFieldType $fieldType */ public function handle(CheckboxesFieldType $fieldType) { $options = array_get($fieldType->getConfig(), 'options', []); if (is_string($options)) { $options = $this->dispatch(new ParseOptions($options)); } if ($options instanceof Collection && $options->isEmpty()) { $options = []; } if ($options instanceof Collection && is_object($first = $options->first())) { if ($first instanceof EntryInterface) { $value = $first->getTitleName(); } else { $value = 'id'; } $options = $options->lists($value, 'id'); } if ($options instanceof Collection && is_string($options->first())) { $options = $options->all(); } $fieldType->setOptions($options); }
/** * Handle the command. * * @param Container $container */ public function handle(Container $container) { $container->call(array_get($this->fieldType->getConfig(), 'handler'), ['fieldType' => $this->fieldType]); }