public function configure($options = array(), $attributes = array()) { parent::configure($options, $attributes); $this->addRequiredOption('page_id'); $this->addRequiredOption('page_culture'); $this->setOption('choices', array()); }
protected function configure($options = array(), $messages = array()) { parent::configure($options, $messages); //Mensagens customizadas $this->setMessage('invalid', isset($messages['invalid']) ? $messages['invalid'] : 'Preenchimento incorreto.'); //Opções adicionais $this->addMessage('required', isset($messages['required']) ? $messages['required'] : 'Obrigatório.'); $this->addMessage('max_length', isset($messages['max_length']) ? $messages['max_length'] : 'Valor muito longo. Preencha no máximo %max_length% caracteres.'); $this->addOption('required'); $this->addOption('max_length'); }
/** * Configures the current validator. * * Available options: * * * countries: An array of country codes to use (ISO 3166) * * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorChoice */ protected function configure($options = array(), $messages = array()) { parent::configure($options, $messages); $this->addOption('countries'); // populate choices with all countries $countries = array_keys(sfCultureInfo::getInstance()->getCountries()); // restrict countries to a sub-set if (isset($options['countries'])) { if ($problems = array_diff($options['countries'], $countries)) { throw new InvalidArgumentException(sprintf('The following countries do not exist: %s.', implode(', ', $problems))); } $countries = $options['countries']; } $this->setOption('choices', $countries); }
/** * Configures the current validator. * * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorChoice */ protected function configure($options = array(), $messages = array()) { parent::configure($options, $messages); // populate choices with all cultures $choices = array(); $cultures = sfCultureInfo::getCultures(sfCultureInfo::SPECIFIC); foreach ($cultures as $culture) { // skip en_US_POSIX if ($culture == "en_US_POSIX") { continue; } try { $choices[] = sfCultureInfo::getInstance($culture)->getName(); } catch (sfException $e) { } } sort($choices); $this->setOption('choices', $choices); }
/** * Configures the current validator. * * Available options: * * * culture: The culture to use for internationalized strings (required) * * languages: An array of language codes to use (ISO 639-1) * * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorChoice */ protected function configure($options = array(), $messages = array()) { parent::configure($options, $messages); $this->addRequiredOption('culture'); $this->addOption('languages'); // populate choices with all languages $culture = isset($options['culture']) ? $options['culture'] : 'en'; $cultureInfo = new sfCultureInfo($culture); $languages = array_keys($cultureInfo->getLanguages()); // restrict languages to a sub-set if (isset($options['languages'])) { if ($problems = array_diff($options['languages'], $languages)) { throw new InvalidArgumentException(sprintf('The following languages do not exist: %s.', implode(', ', $problems))); } $languages = $options['languages']; } sort($languages); $this->setOption('choices', $languages); }
/** * Configures the current validator. * * @see sfValidatorChoice */ protected function configure($options = array(), $messages = array()) { parent::configure($options, $messages); $this->setOption('multiple', true); }
/** * Configures the current validator. * * Available options: * * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorChoice */ protected function configure($options = array(), $messages = array()) { parent::configure($options, $messages); $this->setOption('choices', array_keys(sfCultureInfo::getInstance()->getTimeZones())); }
/** * options: * * @param string $options * @param string $messages * @return void * @author Brent Shaffer */ protected function configure($options = array(), $messages = array()) { $this->addOption('glue', ','); parent::configure($options, $messages); }
public function configure($options = array(), $attributes = array()) { parent::configure($options, $attributes); $this->setOption('choices', array()); }
public function configure($options = array(), $attributes = array()) { parent::configure($options, $attributes); $array = sfPlop::get('sf_plop_googlemaps_zooms'); $this->setOption('choices', $array); }