Php 表单操作在细枝模板内不起作用
嗨,我有问题在树枝模板。我正在尝试的是使用自定义模块和jquery文件上传器将图像上传到s3 bucket,因为我创建了一个自定义字段类型,但我被困在了一个地方,我正在尝试从表单元素页面呈现小树枝。Twig正在渲染,但部分无法工作不知道为什么这里是我的field widget类Php 表单操作在细枝模板内不起作用,php,jquery,twig,drupal-8,custom-field-type,Php,Jquery,Twig,Drupal 8,Custom Field Type,嗨,我有问题在树枝模板。我正在尝试的是使用自定义模块和jquery文件上传器将图像上传到s3 bucket,因为我创建了一个自定义字段类型,但我被困在了一个地方,我正在尝试从表单元素页面呈现小树枝。Twig正在渲染,但部分无法工作不知道为什么这里是我的field widget类 public function formElement( FieldItemListInterface $items, $delta, Array $element, Array &$form, FormSta
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;
}
这是小枝课
{{ 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>
{{attach_library('s3_file_uploader/s3_file_uploader-styles')}
{%为键,值在s3FormDetails.inputs%}
{%endfor%}
在twig类中,一切都正常工作,但表单标签内的一切都不正常不知道为什么请帮助提交按钮在哪里?我没有提交按钮我必须实现的是,当我单击托管文件时,它将加载jquery文件上载并将所选图像发送到s3