本文整理汇总了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);
}
示例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="'));
}
示例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' : ''));
}
示例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);
}