/** * Configures the current widget. * * Available options: * * * image: The image path to represent the widget (false by default) * * config: A JavaScript array that configures the JQuery date widget * * culture: The user culture * * @param array $options An array of options * @param array $attributes An array of default HTML attributes * * @see sfWidgetForm */ protected function configure($options = array(), $attributes = array()) { parent::configure($options, $attributes); $this->addOption('with_time', false); $this->addOption('time', array('format_without_seconds' => '%hour%時%minute%分', 'minutes' => array('00', '10', '20', '30', '40', '50'))); $this->setOption('culture', 'ja'); $this->getOption('date_widget')->setOption('format', '%year%年%month%月%day%日'); if ($this->getOption('config') === '{}') { $this->setOption('config', '{buttonText: "カレンダーで選択"}'); } }
protected function configure($options = array(), $attributes = array()) { parent::configure(); $this->addOption('date_range', array()); $this->addOption('date_widget_options', array()); $this->setOption('image', '/images/calendar.png'); if (isset($options['date_range'])) { $years = range($options['date_range']['min'], $options['date_range']['max']); unset($options['date_range']); } else { $years = range(2009, date('Y') + 2); } $date_widget_options = array('culture' => 'fr', 'years' => array_combine($years, $years), 'can_be_empty' => true); if (isset($options['date_widget_options'])) { $date_widget_options = array_merge($date_widget_options, $options['date_widget_options']); } $this->date_widget = new sfWidgetFormI18nDate($date_widget_options); // $this->setOption( // 'date_widget', // $date_widget // ); $this->setOption('culture', 'fr'); $this->setOption('config', '{showMonthAfterYear: false, firstDay: 1}'); }