public function formatRow($label, $field, $errors = array(), $help = '', $hiddenFields = null)
 {
     $originalRowFormat = $this->rowFormat;
     if (strpos($field, 'type="radio"') || strpos($field, 'type="checkbox"')) {
         $isCheckboxList = strpos($field, 'checkbox_list') !== false;
         $field = str_replace(array('<ul class="radio_list">', '<ul class="checkbox_list">', '</ul>', '<li>', '</li>'), array('', '', '', '', ''), $field);
         //change order of input and label tags
         $pattern = '#(<input\\b[^>]*/>)(.*?)(<label\\b[^>]*>)(.*?)(</label>)$#';
         $replacement = '$3$4$5$1';
         $rows = explode("\n", $field);
         foreach ($rows as $index => $row) {
             $rows[$index] = preg_replace($pattern, $replacement, $row);
         }
         $field = implode("\n", $rows);
         if ($isCheckboxList) {
             $label = substr($label, strpos($label, '>') + 1);
             $label = substr($label, 0, strpos($label, '<'));
             $field = '<fieldset data-role="controlgroup"><legend>' . $label . '</legend>' . $field . '</fieldset>';
             $label = null;
         } else {
             $field = '<div data-role="controlgroup">' . $field . '</div>';
         }
     }
     $row = parent::formatRow($label, $field, $errors, $help, $hiddenFields);
     $this->rowFormat = $originalRowFormat;
     $fieldName = substr($label, strpos($label, ' for="') + 6);
     $fieldName = substr($fieldName, 0, strpos($fieldName, '"'));
     return strtr($row, array('%row_class%' => count($errors) > 0 ? ' error' : '', '%fieldname%' => $fieldName, ' type="' => count($errors) > 0 ? ' class="error" type="' : ' type="'));
 }
 /**
  * Sets a callable which aims to translate form labels, errors and help messages
  *
  * @param  mixed  $callable
  *
  * @throws InvalidArgumentException if an invalid php callable or sfCallable has been provided
  */
 public static function setTranslationCallable($callable)
 {
     if (!$callable instanceof sfCallable && !is_callable($callable)) {
         throw new InvalidArgumentException('Provided i18n callable should be either an instance of sfCallable or a valid PHP callable');
     }
     self::$translationCallable = $callable;
 }
 public function generateLabelName($name)
 {
     $labelName = parent::generateLabelName($name);
     if (isset($this->validatorSchema[$name]) && $this->validatorSchema[$name]->getOption('required')) {
         $labelName .= '<sup class="required">*</sup>';
     }
     return $labelName;
 }
 public function generateLabel($name, $attributes = array())
 {
     if (isset($attributes['class'])) {
         $attributes['class'] .= ' control-label';
     } else {
         $attributes['class'] = 'control-label';
     }
     return parent::generateLabel($name, $attributes);
 }
 public function generateLabelName($name)
 {
     $this->name = $name;
     $label = parent::generateLabelName($name);
     $validatorSchema = $this->form->getValidatorSchema();
     if (isset($validatorSchema[$name]) && $validatorSchema[$name]->getOption('required')) {
         $label .= ' <span class="form-required" title="This field is required.">*</span>';
     }
     return $label;
 }
 public function generateLabel($name, $attributes = array())
 {
     $validatorSchema = $this->form->getValidatorSchema();
     $class = isset($validatorSchema[$name]) && $validatorSchema[$name]->getOption('required') ? 'required' : '';
     if (isset($attributes['class'])) {
         $attributes['class'] .= ' ' . $class;
     } else {
         $attributes['class'] = $class;
     }
     return parent::generateLabel($name, $attributes);
 }
  public function formatRow($label, $field, $errors = array(), $help = '', $hiddenFields = null)
  {
    $row = parent::formatRow(
      $label,
      $field,
      $errors,
      $help,
      $hiddenFields
    );

    return strtr($row, array(
      '%row_class%' => (count($errors) > 0) ? ' form_error' : '',
    ));
  }
 /**
  * Generates a label for the given field name.
  *
  * @param  string $name        The field name
  * @param  array  $attributes  Optional html attributes for the label tag
  *
  * @return string The label tag
  */
 public function generateLabelName($name)
 {
     $isRequired = false;
     if ($this->validatorSchema and isset($this->validatorSchema[$name])) {
         $validator = $this->validatorSchema[$name];
         if ($validator->getOption('required')) {
             $class_name = $this->getParameter('required_label_class_name', 'required');
             $isRequired = true;
         }
     }
     $s = parent::generateLabelName($name);
     $s = str_replace('%label%', $s, $this->labelFormat);
     if ($isRequired) {
         $format = $this->getParameter('required_label_format', $this->requiredLabelFormat);
         $s = str_replace('%label%', $s, $format);
     }
     return $s;
 }
<?php

// auto-generated by sfFactoryConfigHandler
// date: 2011/06/03 16:22:59
$class = sfConfig::get('sf_factory_logger', 'sfAggregateLogger');
$this->factories['logger'] = new $class($this->dispatcher, array_merge(array('auto_shutdown' => false), sfConfig::get('sf_factory_logger_parameters', array('level' => 'debug'))));
$logger = new sfWebDebugLogger($this->dispatcher, array_merge(array('auto_shutdown' => false), array('level' => 'debug', 'xdebug_logging' => true, 'web_debug_class' => 'sfWebDebug')));
$this->factories['logger']->addLogger($logger);
$logger = new sfFileLogger($this->dispatcher, array_merge(array('auto_shutdown' => false), array('level' => 'debug', 'file' => '/opt/httpd-builtin-2.2.0/afids/log/frontend_dev.log')));
$this->factories['logger']->addLogger($logger);
if (sfConfig::get('sf_i18n')) {
    $class = sfConfig::get('sf_factory_i18n', 'sfI18N');
    $cache = new sfFileCache(array('automatic_cleaning_factor' => 0, 'cache_dir' => '/opt/httpd-builtin-2.2.0/afids/cache/frontend/dev/i18n', 'lifetime' => 31556926, 'prefix' => '/opt/httpd-builtin-2.2.0/afids/apps/frontend/i18n'));
    $this->factories['i18n'] = new $class($this->configuration, $cache, array('source' => 'XLIFF', 'debug' => false, 'untranslated_prefix' => '[T]', 'untranslated_suffix' => '[/T]'));
    sfWidgetFormSchemaFormatter::setTranslationCallable(array($this->factories['i18n'], '__'));
}
$class = sfConfig::get('sf_factory_controller', 'sfFrontWebController');
$this->factories['controller'] = new $class($this);
$class = sfConfig::get('sf_factory_request', 'sfWebRequest');
$this->factories['request'] = new $class($this->dispatcher, array(), array(), sfConfig::get('sf_factory_request_parameters', array('logging' => '1', 'path_info_array' => 'SERVER', 'path_info_key' => 'PATH_INFO', 'relative_url_root' => NULL, 'formats' => array('txt' => 'text/plain', 'js' => array(0 => 'application/javascript', 1 => 'application/x-javascript', 2 => 'text/javascript'), 'css' => 'text/css', 'json' => array(0 => 'application/json', 1 => 'application/x-json'), 'xml' => array(0 => 'text/xml', 1 => 'application/xml', 2 => 'application/x-xml'), 'rdf' => 'application/rdf+xml', 'atom' => 'application/atom+xml'), 'no_script_name' => false)), sfConfig::get('sf_factory_request_attributes', array()));
$class = sfConfig::get('sf_factory_response', 'sfWebResponse');
$this->factories['response'] = new $class($this->dispatcher, sfConfig::get('sf_factory_response_parameters', array_merge(array('http_protocol' => isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : null), array('logging' => '1', 'charset' => 'utf-8', 'send_http_headers' => true))));
if ($this->factories['request'] instanceof sfWebRequest && $this->factories['response'] instanceof sfWebResponse && 'HEAD' == $this->factories['request']->getMethod()) {
    $this->factories['response']->setHeaderOnly(true);
}
$class = sfConfig::get('sf_factory_routing', 'sfPatternRouting');
$cache = null;
$this->factories['routing'] = new $class($this->dispatcher, $cache, array_merge(array('auto_shutdown' => false, 'context' => $this->factories['request']->getRequestContext()), sfConfig::get('sf_factory_routing_parameters', array('load_configuration' => true, 'suffix' => '', 'default_module' => 'default', 'default_action' => 'index', 'debug' => '1', 'logging' => '1', 'generate_shortest_url' => true, 'extra_parameters_as_query_string' => true, 'cache' => NULL))));
if ($parameters = $this->factories['routing']->parse($this->factories['request']->getPathInfo())) {
    $this->factories['request']->addRequestParameters($parameters);
}
 public function unnestErrors($errors, $prefix = '')
 {
     return parent::unnestErrors($errors, $prefix);
 }
 public function generateLabel($name, $attributes = array())
 {
     $attributes['class'] = 'control-label';
     return parent::generateLabel($name, $attributes);
 }
 public function generateLabelName($name)
 {
     $this->lastWidgetName = $name;
     return parent::generateLabelName($name);
 }
 public function formatRow($label, $field, $errors = array(), $help = '', $hiddenFields = null)
 {
     return strtr(parent::formatRow($label, $field, $errors, $help, $hiddenFields), array('%is_error%' => count($errors) > 0 ? ' field_error' : ''));
 }
 /**
  * Отрисовать поле формы
  *
  * Хак, чтобы поменять местами checkbox и label
  */
 public function formatRow($label, $field, $errors = array(), $help = '', $hiddenFields = null)
 {
     if (strpos($field, 'checkbox') !== false) {
         return parent::formatRow($field, $label, $errors, $help, $hiddenFields);
     }
     return parent::formatRow($label, $field, $errors, $help, $hiddenFields);
 }
 /**
  * Constructor
  *
  * @param sfWidgetFormSchema $widgetSchema
  */
 public function __construct(sfWidgetFormSchema $widgetSchema)
 {
     $this->setTranslationCatalogue('sfAsset');
     parent::__construct($widgetSchema);
 }
 /**
  * Overloading this method as a way to strip required from labels
  *
  * Bit of a hack!
  *
  * @param   mixed   $errors
  * @return  string
  */
 public function formatErrorsForRow($errors)
 {
     if (is_array($errors) && $this->getMarkRequired()) {
         foreach ($errors as $name => $error) {
             $fixedName = str_replace($this->requiredFormat, '', $name);
             if ($fixedName != $name) {
                 $errors[$fixedName] = $error;
                 unset($errors[$name]);
             }
         }
     }
     return parent::formatErrorsForRow($errors);
 }