Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function buzzd_form_field($opts)
- {
- $edit_enabled = BuzzdHelper::getSettings()->get('form edit enabled');
- $field = $opts['field'];
- $is_textarea = false;
- $is_input = false;
- switch (get_class($field->getWidget())) {
- case 'sfWidgetFormInput': {
- $is_input = true;
- break;
- } case 'sfWidgetFormTextarea': {
- $is_textarea = true;
- break;
- } case 'sfWidgetFormSelectRadio': {
- $is_radio = true;
- break;
- } case 'sfWidgetFormInputFile': {
- $is_input = true;
- break;
- }
- default: d::ve(get_class($field->getWidget()),2);
- }
- if ($is_textarea||$is_input) {
- $field->getWidget()->setAttribute('class','generic-input');
- } elseif ($is_radio) {
- $field->getWidget()->setOption('formatter',array(new __BuzzdRadioFormatter(),'formatter'));
- if (isset($opts['choices'])) {
- $field->getWidget()->setOption('choices',$opts['choices']);
- }
- }
- $multiline = ('multiline'===$opts['left or right']);
- ob_start();
- ?>
- <?php if (!$multiline): ?> <div class="detail-column <?php echo $opts['left or right'] ?>"> <?php endif ?>
- <span class="user-detail-title"><?php echo $field->renderLabel()?></span>
- <div class="user-detail-text<?php $multiline and print(' user-detail-text-multiline') ?>">
- <div class='view-field'><?php
- if (strlen($field->getValue())) {
- if (isset($opts['choices'])) {
- echo $opts['choices'][$field->getValue()];
- } else {
- echo $field->getValue();
- }
- } else {
- echo "<div class='prop blank-textarea-height'> </div>\n";
- }
- ?></div>
- <div class='edit-field'>
- <?php echo $field ?>
- <?php if (isset($opts['note'])) : ?>
- <div class='generic-field-note'><em><?php echo $opts['note'] ?></em></div>
- <?php endif; ?>
- </div>
- <?php if ($field->hasError()): ?>
- <?php echo $field->renderError() ?>
- <?php /* <ul class='error-list-small'><li><?php echo $field->renderError() ?></li></ul> */ ?>
- <?php endif; ?>
- </div>
- <?php if (!$multiline): ?></div><?php endif ?>
- <?php
- return ob_get_clean();
- }
Add Comment
Please, Sign In to add comment