/** * Builds a few basic options * * @return void */ public function build() { parent::build(); $value = $this->validator->arrayGet($this->suppliedOptions, 'value', true); //we need to set the value to 'false' when it is falsey so it plays nicely with select2 if (!$value && $value !== '') { $this->suppliedOptions['value'] = 'false'; } }
/** * Builds a few basic options */ public function build() { parent::build(); //set the upload url depending on the type of config this is $url = $this->validator->getUrlInstance(); $route = $this->config->getType() === 'settings' ? 'admin_settings_file_upload' : 'admin_file_upload'; //set the upload url to the proper route $this->suppliedOptions['upload_url'] = $url->route($route, array($this->config->getOption('name'), $this->suppliedOptions['field_name'])); }
/** * Builds a few basic options */ public function build() { parent::build(); //set the upload url to the proper route if ($this->config->getType() === 'settings') { $this->suppliedOptions['upload_url'] = admin_url('settings/' . $this->config->getOption('name') . '/' . $this->suppliedOptions['field_name'] . '/file_upload'); } else { $this->suppliedOptions['upload_url'] = admin_url($this->config->getOption('name') . '/' . $this->suppliedOptions['field_name'] . '/file_upload'); } }
/** * Builds a few basic options */ public function build() { parent::build(); $options = $this->suppliedOptions; $dataOptions = $options['options']; $options['options'] = array(); //iterate over the options to create the options assoc array foreach ($dataOptions as $val => $text) { $options['options'][] = array('id' => is_numeric($val) ? $text : $val, 'text' => $text); } $this->suppliedOptions = $options; }
/** * Builds a few basic options */ public function build() { parent::build(); $options = $this->suppliedOptions; $model = $this->config->getDataModel(); $relationship = $model->{$options['field_name']}(); //set the search fields to the name field if none exist $searchFields = $this->validator->arrayGet($options, 'search_fields'); $nameField = $this->validator->arrayGet($options, 'name_field', $this->defaults['name_field']); $options['search_fields'] = empty($searchFields) ? array($nameField) : $searchFields; //determine if this is a self-relationship $options['self_relationship'] = $relationship->getRelated()->getTable() === $model->getTable(); //make sure the options filter is set up $options['options_filter'] = $this->validator->arrayGet($options, 'options_filter') ?: function () { }; //set up and check the constraints $this->setUpConstraints($options); //load up the relationship options $this->loadRelationshipOptions($options); $this->suppliedOptions = $options; }