wpWidgetFormInputFile.class.php 1.0 KB

123456789101112131415161718192021222324
  1. <?php
  2. class wpWidgetFormInputFile extends sfWidgetFormInputFile {
  3. /**
  4. *
  5. * @param string $name The element name
  6. * @param string $value The value displayed in this widget
  7. * @param array $attributes An array of HTML attributes to be merged with the default HTML attributes
  8. * @param array $errors An array of errors for the field
  9. * @return string An HTML tag string
  10. * @see sfWidgetForm
  11. */
  12. public function render($name, $value = null, $attributes = array(), $errors = array()) {
  13. $file_src = $this->getAttribute('file_src');
  14. $this->setAttribute('file_src', null);
  15. $return = parent::render($name, $value, $attributes, $errors);
  16. if ('' != $file_src && is_file(sfConfig::get('sf_web_dir') . $file_src)) {
  17. $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>';
  18. }
  19. return $return;
  20. }
  21. }