当前位置: 首页>>代码示例>>PHP>>正文


PHP sfWidgetFormSchemaFormatter::formatRow方法代码示例

本文整理汇总了PHP中sfWidgetFormSchemaFormatter::formatRow方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWidgetFormSchemaFormatter::formatRow方法的具体用法?PHP sfWidgetFormSchemaFormatter::formatRow怎么用?PHP sfWidgetFormSchemaFormatter::formatRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfWidgetFormSchemaFormatter的用法示例。


在下文中一共展示了sfWidgetFormSchemaFormatter::formatRow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formatRow

 public function formatRow($label, $field, $errors = array(), $help = '', $hiddenFields = null)
 {
     if (preg_match('/<input [^>]*type="checkbox"/', $field)) {
         return parent::formatRow(preg_replace('/<label[^>]*>/', "\$0{$field}", $label), null, $errors, $help, $hiddenFields);
     }
     return parent::formatRow($label, $field, $errors, $help, $hiddenFields);
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:7,代码来源:sfDrupalWidgetFormSchemaFormatter.class.php

示例2: formatRow

 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="'));
 }
开发者ID:muliadi,项目名称:jfportabledevice,代码行数:29,代码来源:sfWidgetFormSchemaFormatterJfPD.class.php

示例3: formatRow

  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' : '',
    ));
  }
开发者ID:nibsirahsieu,项目名称:sfNestedCommentPlugin,代码行数:14,代码来源:sfWidgetFormSchemaFormatterComment.class.php

示例4: formatRow

 /**
  * @see parent
  */
 public function formatRow($label, $field, $errors = array(), $help = '', $hiddenFields = null)
 {
     $row = parent::formatRow($label, $field, $errors, $help, $hiddenFields);
     $rowClasses = array();
     if (count($errors) > 0 && $this->rowErrorClass) {
         $rowClasses[] = $this->rowErrorClass;
     }
     if ($this->useLabelForAsClassesInFormRow) {
         // try match the field id and classes to add as a class to the row as a way
         // to target the field
         preg_match_all('/for=(\'|")([\\w]*)(\'|")/', $label, $matches, PREG_SET_ORDER);
         if ($matches) {
             foreach ($matches as $match) {
                 $rowClasses[] = $match[2];
             }
         }
     }
     return strtr($row, array('%row_class%' => count($rowClasses) ? ' ' . implode(', ', array_unique($rowClasses)) : ''));
 }
开发者ID:kevindew,项目名称:sfJqueryValidationPlugin,代码行数:22,代码来源:sfWidgetFormSchemaFormatterJqueryValidation.class.php

示例5: formatRow

 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' : ''));
 }
开发者ID:nacmartin,项目名称:skinny,代码行数:4,代码来源:sfWidgetFormSchemaFormatterDiv.class.php

示例6: formatRow

 /**
  * Отрисовать поле формы
  *
  * Хак, чтобы поменять местами 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);
 }
开发者ID:pycmam,项目名称:neskuchaik.ru,代码行数:12,代码来源:sfWidgetFormSchemaFormatterMyList.class.php


注:本文中的sfWidgetFormSchemaFormatter::formatRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。