dougui2254 2017-03-30 09:23
浏览 18

表格动作不适用于树枝模板

Hi i am having issue in twig template. What i am trying is to upload image to s3 bucket using custom module and jquery file uploader for that i have createa a custom field type but m stuck in a place where i am trying to render twig from form element page. Twig is rendering but part of it is not working dont know why here is my field widget class

 public function formElement(
FieldItemListInterface $items,
$delta,
Array $element,
Array &$form,
FormStateInterface $formState
 ) {
 $s3FormDetailss = GetSignature::getSignature();// To get the policy

$element['s3_select_image'] = array(
 '#theme' => 'image_uploade_page',
 '#s3FormDetails' => $s3FormDetailss,
     $element['#attached']['drupalSettings']['variable'] =     $s3FormDetailss,
     $element['#attached']['library'][]=    's3_file_uploader/s3_file_uploader-styles',
  );



return $element;
 }

Here is twig class

{{ attach_library('s3_file_uploader/s3_file_uploader-styles') }}
<div class="container">
        <!-- <h1>Direct Upload to data</h1> -->

        <!-- This part is not working and everything else is working -->
        <form action= "{{ s3FormDetails.url }}"
              method="POST"
              enctype="multipart/form-data"
              class="direct-upload">

              {% for key,value in s3FormDetails.inputs %}
                         <input type="hidden" name="{{ key }}" value="{{ value }}">
                     {% endfor %}
                     <!-- Key is the file's name on S3 and will be filled in with JS -->
                     <input type="hidden" name="key" value="">
                     <input type="file" name="file" multiple>

                     <!-- Progress Bars to show upload completion percentage -->
                     <div class="progress-bar-area"></div>


        </form>

        <!-- This area will be filled with our results (mainly for debugging) -->
        <div>
          <!--  <h3>Files</h3> -->
            <textarea id="uploaded" name="hide" style="display:none;"></textarea>
        </div>

    </div>

in twig class everything is working as it should be but everything inside form tag is not working dont know why please help

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用