當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。