コード例 #1
0
ファイル: FilterDate.php プロジェクト: rande/sfFormBundle
 /**
  * @param  string $name        The element name
  * @param  string $value       The date displayed in this widget
  * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
  * @param  array  $errors      An array of errors for the field
  *
  * @return string An HTML tag string
  *
  * @see 
  */
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     $values = array_merge(array('is_empty' => ''), is_array($value) ? $value : array());
     return strtr($this->getOption('filter_template'), array('%date_range%' => parent::render($name, $value, $attributes, $errors), '%empty_checkbox%' => $this->getOption('with_empty') ? $this->renderTag('input', array('type' => 'checkbox', 'name' => $name . '[is_empty]', 'checked' => $values['is_empty'] ? 'checked' : '')) : '', '%empty_label%' => $this->getOption('with_empty') ? $this->renderContentTag('label', $this->translate($this->getOption('empty_label')), array('for' => $this->generateId($name . '[is_empty]'))) : ''));
 }