Добавление подполя в форму

Anton25

Новичок
Очень нужна помощь. Я не особо в пхп, а поисковики не выдают адекватных результатов. Вот есть форма создания новой темы на форуме. Как в element File вставить дополнительное поле input(text) с определёнными параметрами, либо div?
PHP:
public function init()
  {
    $settings = Engine_Api::_()->getApi('settings', 'core');
    $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
    $this->setMethod("POST");
    $this->setAttrib('name', 'forum_post_create');

    $this->addElement('Text', 'title', array(
      'allowEmpty' => false,
      'required' => true,
      'filters' => array(
        new Engine_Filter_Censor(),
      ),
    ));
    $viewer = Engine_Api::_()->user()->getViewer();
    $allowHtml = (bool) $settings->getSetting('forum_html', 0);
    $allowBbcode = (bool) $settings->getSetting('forum_bbcode', 0);
    if( !$allowHtml ) {
      $filter = new Engine_Filter_HtmlSpecialChars();
    } else {
      $filter = new Engine_Filter_Html();
      $filter->setForbiddenTags();
      //$allowed_tags = array_map('trim', explode(',', Engine_Api::_()->authorization()->getPermission($viewer->level_id, 'forum', 'commentHtml')));
      if( !$viewer->getIdentity() ) {
        $allowed_tags = array_map('trim', explode(',', Engine_Api::_()->authorization()->getPermission(4, 'forum', 'commentHtml')));
      }else{
        $allowed_tags = array_map('trim', explode(',', Engine_Api::_()->authorization()->getPermission($viewer->level_id, 'forum', 'commentHtml')));
      }
      $filter->setAllowedTags($allowed_tags);
    }
    if( $allowHtml || $allowBbcode ) {
      $upload_url = "";
if(Engine_Api::_()->authorization()->isAllowed('album', $user, 'create')){
        $upload_url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action'=>'upload-photo'),'forum_photo',true);
      }
      $editorOptions = array(
        'upload_url' => $upload_url,
        'bbcode' => $settings->getSetting('forum_bbcode', 0),
        'html' => $settings->getSetting('forum_html', 0)
      );
      if (!empty($upload_url))
      {
        $editorOptions['plugins'] = array(
          'table', 'fullscreen', 'media', 'preview', 'paste',
          'code', 'image', 'textcolor', 'jbimages', 'link'
        );
        $editorOptions['toolbar1'] = array(
          'undo', 'redo', 'removeformat', 'pastetext', '|', 'code',
          'media', 'image', 'jbimages', 'link', 'fullscreen',
          'preview'
        );
      }
      $this->addElement('TinyMce', 'body', array(
        'disableLoadDefaultDecorators' => true,
        'editorOptions' => $editorOptions,
        'required' => true,
        'allowEmpty' => false,
        'decorators' => array('ViewHelper'),
        'filters' => array(
          $filter,
          new Engine_Filter_Censor(),
        ),
      ));
    }
    // Photo
    $this->addElement('File', 'photo', array(
      'label' => 'Attach a Photo',
      'size' => '0',
      ));
    $this->getElement('photo')->getDecorator('label')->setOptions(array('escape' => false,'class' => 'buttonlink'));
    $show_captcha = Engine_Api::_()->getApi('settings', 'core')->core_spam_contact;
    if( $show_captcha && ($show_captcha > 1 || !Engine_Api::_()->user()->getViewer()->getIdentity() ) ) {
      $this->addElement('captcha', 'captcha', Engine_Api::_()->core()->getCaptchaOptions());
    }
    $this->addElement('Button', 'submit', array(
      'label' => 'Post Topic',
      'type' => 'submit',
      'ignore' => true,
      'decorators' => array('ViewHelper')
    ));
    $this->addElement('Cancel', 'cancel', array(
      'label' => 'cancel',
      'link' => true,
      'prependText' => ' or ',
      'decorators' => array(
        'ViewHelper'
      )
    ));
 
Последнее редактирование модератором:

grigori

( ͡° ͜ʖ ͡°)
Команда форума
этот вопрос нужно задавать на форуме поддержки того форума, который ты пытаешься доработать, здесь никто этот код не знает
 
Сверху