This gist inspried by sasso's comment and gist.
Edit index.html, add script after #graphiql
element as below.
<!-- HTML 輸出檔案 - submit / reset 按鈕在同一個區塊裡 --> | |
<form> | |
<!-- 其他欄位資料 --> | |
<div class="form-group"> | |
<div class="col-sm-2"></div> | |
<div class="col-sm-10"> |
{# HTML + Twig - 依序處理 form.field, 並特別處理 submit / reset #} | |
{{ form_start(form) }} | |
{{ form_row(form.field_A) }} | |
{{ form_row(form.field_B) }} | |
{{ form_row(form.field_C) }} | |
<div class="form-group"> |
{# HTML + Twig 樣板檔案 - 先單獨顯示 submit / reset,再用 form_reset 處理其他的 #} | |
{{ form_start(form) }} | |
<div class="form-group"> | |
<div class="col-sm-2"></div> | |
<div class="col-sm-10"> | |
{{ form_widget(form.submit) }} | |
{{ form_widget(form.reset) }} |
<?php | |
/* Silex form builder 檔案 */ | |
$form = $app->form () | |
->add ('submit', SubmitType::class, ['block_name' => 'buttons_start']) | |
->add ('reset', ResetType::class, ['block_name' => 'buttons_end']) | |
->getForm (); |
{# Twig 樣板檔案 - 定義 block_name 為 buttons_start / buttons_end 的兩區塊樣板 #} | |
{# 按鈕開始區塊 #} | |
{% block _form_buttons_start_row -%} | |
<div class="form-group"> | |
<div class="{{ block('form_label_class') }}"></div> | |
<div class="{{ block('form_group_class') }}"> | |
{{- form_widget(form) -}} | |
{%- endblock _form_buttons_start_row %} |
<?php | |
use Symfony\Component\Form\FormRenderer; | |
$app->extend ('twig.runtimes', function ($array) { | |
$array[FormRenderer::class] = 'twig.form.renderer'; | |
return $array; | |
}); |
sh-3.2# curl --silent --verbose http://www.purestudio.com.tw/blog/product/20180323/ --resolve www.purestudio.com.tw:80:124.150.132.74 --insecure | |
* Added www.purestudio.com.tw:80:124.150.132.74 to DNS cache | |
* Hostname www.purestudio.com.tw was found in DNS cache | |
* Trying 124.150.132.74... | |
* TCP_NODELAY set | |
* Connected to www.purestudio.com.tw (124.150.132.74) port 80 (#0) | |
> GET /blog/product/20180323/ HTTP/1.1 | |
> Host: www.purestudio.com.tw | |
> User-Agent: curl/7.54.0 | |
> Accept: */* |
/** | |
* | |
* API access | |
* | |
*/ | |
var api = (function () { | |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: mattermost | |
# Required-Start: $network $syslog | |
# Required-Stop: $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Mattermost Group Chat | |
# Description: Mattermost: An open-source Slack | |
### END INIT INFO |