<?php

class wpWidgetFormInputFile extends sfWidgetFormInputFile {
    /**
     *
     * @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 sfWidgetForm
     */
    public function render($name, $value = null, $attributes = array(), $errors = array()) {
        $file_src = $this->getAttribute('file_src');
        $this->setAttribute('file_src', null);
        $return = parent::render($name, $value, $attributes, $errors);

        if ('' != $file_src && is_file(sfConfig::get('sf_web_dir') . $file_src)) {
            $return .= '<br />' . thumbnail_tag($file_src, 80, 80) . '<br /><input name="RemovePicture" id="RemovePictureId" value="1" type="checkbox" />&nbsp;<label for="RemovePictureId">Supprimer la photo</label>';
        }

        return $return;
    }
}