/** * @param string $name The element name * @param string $value The value displayed in this widget * @param array $attributes An array of HTML attributes to be merged with the default HTML attributes * @param array $errors An array of errors for the field * * @return string An HTML tag string * * @see sfWidgetFormInput */ public function render($name, $value = null, $attributes = array(), $errors = array()) { sfProjectConfiguration::getActive()->loadHelpers('sfAsset'); init_asset_library(); $html = parent::render($name, $value, $attributes, $errors) . ' '; $attributes = $this->fixFormId(array('name' => $name)); $html .= input_sf_asset_image_tag($name, array('id' => $attributes['id'], 'type' => $this->getOption('asset_type'))); return $html; }
<?php use_stylesheets_for_form($form) ?> <?php use_javascripts_for_form($form) ?> <?php use_helper('sfAsset') ?> <?php echo init_asset_library() ?> <div class="sf_admin_form"> <?php echo form_tag_for($form, '@sf_simple_blog_post') ?> <?php echo $form->renderHiddenFields(false) ?> <?php if ($form->hasGlobalErrors()): ?> <?php echo $form->renderGlobalErrors() ?> <?php endif; ?> <?php foreach ($configuration->getFormFields($form, $form->isNew() ? 'new' : 'edit') as $fieldset => $fields): ?> <?php include_partial('sfSimpleBlogPostAdmin/form_fieldset', array('sf_simple_blog_post' => $sf_simple_blog_post, 'form' => $form, 'fields' => $fields, 'fieldset' => $fieldset)) ?> <?php endforeach; ?> <?php include_partial('sfSimpleBlogPostAdmin/form_actions', array('sf_simple_blog_post' => $sf_simple_blog_post, 'form' => $form, 'configuration' => $configuration, 'helper' => $helper)) ?> </form> </div> <?php if (!$form->isNew()): ?> <?php include_partial('versions', array('versions' => $form->getObject()->getAllVersions(), 'sf_simple_blog_post' => $sf_simple_blog_post)) ?> <?php endif; ?>
<?php $sw_blog_post = $form->getObject(); ?> <?php use_helper('sfAsset'); echo init_asset_library(); ?> <?php if ($form->isNew()) { ?> <h2><?php echo sw_t(__('title_new_blog_post', null, 'swBlogPostsAdmin')); ?> </h2> <?php } else { ?> <h2><?php echo sw_t(__('title_edit_blog_post', null, 'swBlogPostsAdmin')); ?> </h2> <?php } ?> <form action="<?php echo url_for('swBlogPostsAdmin/update' . (!$form->isNew() ? '?id=' . $sw_blog_post['id'] : '')); ?>