<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Engine_Form_Decorator_FormHTMLUpload extends Zend_Form_Decorator_Abstract
{
  public function render($content)
  {
    $data = $this->getElement()->getAttrib('data');
    if ($data) {
        $this->getElement()->setAttrib('data', null);
    }
    $element = $this->getElement();
    $view = $this->getElement()->getView();
 

    $context = 'name="' . $element->getName() . '"';
    $context .= ' data-url="' . $element->url . '"';
    if (!empty($element->{'form'})) {
      $context .= ' data-form-id="' . $element->{'form'} . '"';
    }
    if (!empty($element->{'multi'})) {
      $context .= ' multiple="multiple"';
    }
    if (!empty($element->{'accept'})) {
      $context .= ' accept="' . $element->{'accept'} . '"';
    }

    return $view->partial('upload/upload.tpl', 'core', [
      'name' => $element->getName(),
      'data' => $data,
      'element' => $element,
      'context' => $context
    ]);
  }
}
