/** * {@inheritDoc} */ public function get_excluded_options($key, $action, $current_value, &$field_data, $step) { if ($step == 2 && $key == 'field_maxlen') { // Get the number of options if this key is 'field_maxlen' return sizeof(explode("\n", $this->request->variable('lang_options', '', true))); } return parent::get_excluded_options($key, $action, $current_value, $field_data, $step); }
/** * {@inheritDoc} */ public function get_excluded_options($key, $action, $current_value, &$field_data, $step) { if ($step == 2 && $key == 'field_default_value') { // 'field_length' == 1 defines radio buttons. Possible values are 1 or 2 only. // 'field_length' == 2 defines checkbox. Possible values are 0 or 1 only. // If we switch the type on step 2, we have to adjust field value. // 1 is a common value for the checkbox and radio buttons. // Adjust unchecked checkbox value. // If we return or save settings from 2nd/3rd page // and the checkbox is unchecked, set the value to 0. if ($this->request->is_set('step') && !$this->request->is_set($key)) { return 0; } // If we switch to the checkbox type but former radio buttons value was 2, // which is not the case for the checkbox, set it to 0 (unchecked). if ($field_data['field_length'] == 2 && $current_value == 2) { return 0; } else { if ($field_data['field_length'] == 1 && $current_value == 0) { return 2; } } } if ($key == 'l_lang_options' && $this->request->is_set($key)) { $field_data[$key] = $this->request->variable($key, array(0 => array('')), true); return $current_value; } return parent::get_excluded_options($key, $action, $current_value, $field_data, $step); }
/** * {@inheritDoc} */ public function get_excluded_options($key, $action, $current_value, &$field_data, $step) { if ($step == 2 && $key == 'field_default_value') { // Permit an empty string if ($action == 'create' && $this->request->variable('field_default_value', '') === '') { return ''; } } return parent::get_excluded_options($key, $action, $current_value, $field_data, $step); }
/** * {@inheritDoc} */ public function get_excluded_options($key, $action, $current_value, &$field_data, $step) { if ($step == 2 && $key == 'field_default_value') { $always_now = $this->request->variable('always_now', -1); if ($always_now == 1 || $always_now === -1 && $current_value == 'now') { $now = getdate(); $field_data['field_default_value_day'] = $now['mday']; $field_data['field_default_value_month'] = $now['mon']; $field_data['field_default_value_year'] = $now['year']; $current_value = 'now'; $this->request->overwrite('field_default_value', $current_value, \src\request\request_interface::POST); } else { if ($this->request->is_set('field_default_value_day')) { $field_data['field_default_value_day'] = $this->request->variable('field_default_value_day', 0); $field_data['field_default_value_month'] = $this->request->variable('field_default_value_month', 0); $field_data['field_default_value_year'] = $this->request->variable('field_default_value_year', 0); $current_value = sprintf('%2d-%2d-%4d', $field_data['field_default_value_day'], $field_data['field_default_value_month'], $field_data['field_default_value_year']); $this->request->overwrite('field_default_value', $current_value, \src\request\request_interface::POST); } else { list($field_data['field_default_value_day'], $field_data['field_default_value_month'], $field_data['field_default_value_year']) = explode('-', $current_value); } } return $current_value; } return parent::get_excluded_options($key, $action, $current_value, $field_data, $step); }