0
임 curently 드루팔 8을 사용하고 난는 drupal8에 나뭇 가지 템플릿에서 양식을 렌더링
모듈 디렉토리 아래에 아래의 코드는
// module/src/Form/ContributeForm
class ContributeForm extends FormBase {
public function getFormId() {
return 'amazing_forms_contribute_form';
}
public function buildForm(array $form, FormStateInterface $form_state)
{
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#required' => TRUE,
);
$form['video'] = array(
'#type' => 'textfield',
'#title' => t('Youtube video'),
);
$form['video'] = array(
'#type' => 'textfield',
'#title' => t('Youtube video'),
);
$form['develop'] = array(
'#type' => 'checkbox',
'#title' => t('I would like to be involved in developing this
material'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}
public function validateForm(array &$form, FormStateInterface $form_state) {
}
public function submitForm(array &$form, FormStateInterface $form_state) {
}
}
지금은에 vairables 위에 렌더링 할 필요가 양식 API를 사용하여 양식을 만들었습니다 나뭇 가지 테마 아래에있을 것입니다
//themes/page.html.twig
<body>
{{form.title}}
{{form.video}}
{{form.video}}
</body>
아래처럼 나뭇 가지 템플릿이 page.html.twig 파일에 변수를 얻을 수 folder.Is ??