Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Drupal モジュール開発入門講座 第4回 フォーム

Drupal モジュール開発入門講座 第4回 フォーム

More Decks by アクイアジャパン Acquia Japan

Other Decks in Programming

Transcript

  1. ୈ4ճ ϑΥʔϜ Drupal Ϟδϡʔϧ ։ൃೖ໳ߨ࠲

  2. Drupal Ϟδϡʔϧ։ൃೖ໳ߨ࠲γϦʔζ – DrupalͰ͸ʮϞδϡʔϧʯͱݺ͹ΕΔɺখ͞ͳιϑτ΢ΣΞΛ࣮૷͢Δ͜ͱͰػೳ֦ுΛ ߦ͍·͢ɻຊ΢ΣϏφʔγϦʔζͰ͸ɺDrupalͷϞδϡʔϧ։ൃʹؔ͢Δجૅ஌ࣝΛղઆ ͠·͢ɻ – DrupalͷόοΫΤϯυपΓʹ͍ͭͯମܥతʹֶͼ͍ͨํɺࣗ෼ͰΧελϜϞδϡʔϧΛ࡞ ΕΔΑ͏ʹͳΓ͍ͨํɺΞΫΠΞೝఆσϕϩούʔࢼݧΛ໨ࢦ͢ํʹ͓͢͢ΊͰ͢ɻ –

    DrupalΛҰ௨Γૢ࡞ͨ͜͠ͱ͕͋ΔํΛର৅ͱ͍ͯ͠·͢ɻ·ͩDrupalΛ৮ͬͨ͜ͱ͕ແ ͍ํ͸ɺॳ৺ऀ޲͚DrupalνϡʔτϦΞϧಈըʢ೔ຊޠʣΛઌʹݟ͓ͯ͘ͱΑΓཧղ͕ਂ ·Γ·͢ɻ
  3. ΞδΣϯμ 1. DrupalͷForm APIͱ͸ 2. ϑΥʔϜͷछྨ 3. ϑΥʔϜΫϥεͷϝιου 4. ϑΥʔϜͷϨϯμϦϯά

    5. ϑΥʔϜͷऔಘͱදࣔ 6. ϑΥʔϜͷมߋ 7. ࿅श໰୊
  4. DrupalͷForm APIͱ͸

  5. DrupalαΠτͰ࣮૷͞Ε͍ͯΔ༷ʑͳϑΥʔϜ ͜ΕΒͷϑΥʔϜ ͸ͲͷΑ͏ʹ࣮૷ ͞Ε͍ͯΔͩΖ ͏ʁ هࣄ࡞੒ϑΥʔϜ ίϝϯτϑΥʔϜ ઃఆϑΥʔϜ ݕࡧϑΥʔϜ ϩάΠϯϑΥʔϜ

  6. DrupalͷForm API – DrupalͷForm API͸ɺHTMLϑΥʔϜΛૢ࡞͢ΔͨΊͷந৅ԽϨΠϠͰ͢ɻ – ϑΥʔϜͷఆٛɺදࣔɺݕূɺૹ৴ɺͱ͍͏ϥΠϑαΠΫϧΛ੍ޚ͠·͢ɻ – \Drupal\Core\Form\FormInterfaceΛ࣮૷ͯ͠ϑΥʔϜΫϥεΛ࡞੒͢Δ͜ͱͰɺΧελ ϜϞδϡʔϧͰϑΥʔϜΛ੍ޚͰ͖·͢ɻ

    – ϑΥʔϜ͕ཁٻ͞ΕΔͱɺϑΥʔϜ͸ϨϯμϦϯάՄೳͳ$form഑ྻͱͯ͠ఆٛ͞Ε· ͢ɻ – $form഑ྻ͸ϨϯμϦϯάͷաఔͰHTMLʹม׵͞ΕɺΤϯυϢʔβʔʹදࣔ͞Ε·͢ɻ https://www.drupal.org/docs/drupal-apis/form- api/introduction-to-form-api
  7. Form APIΛར༻͢ΔϝϦοτ ϑΥʔϜͷ࡞੒ʹForm APIΛར༻͢Δ͜ͱͰɺ࣍ͷར఺͕͋Γ·͢ɻ – શͯͷϑΥʔϜͰҰ؏ͨ͠HTMLग़ྗ͕ՄೳʹͳΓ·͢ɻ – ผϞδϡʔϧͰఏڙ͞ΕΔϑΥʔϜ͸ɺෳࡶͳݕࡧ΍ஔ׵ϩδοΫΛ࢖༻͢ Δ͜ͱͳ͘؆୯ʹมߋͰ͖·͢ɻ –

    ϑΝΠϧΞοϓϩʔυ΍౤ථ΢ΟδΣοτͳͲͷෳࡶͳϑΥʔϜཁૉ͸ɺද ࣔ/ॲཧϩδοΫͷ྆ํΛؚΉ࠶ར༻ՄೳͳόϯυϧʹΧϓηϧԽͰ͖·͢ɻ
  8. ϑΥʔϜ࣮૷ͷओͳྲྀΕ 1. ϑΥʔϜΫϥεͷ࡞੒ \Drupal\Core\Form\FormInterface Λ࣮૷ͨ͠FormBaseɺConfigFormBaseɺConfirmFormBaseͱ ͍͏جఈΫϥε͕༻ҙ͞Ε͍ͯ·͢ɻϑΥʔϜͷ༻్ʹ߹Θͤͯ͜ΕΒͷجఈΫϥε͕ར༻Ͱ͖ ·͢ɻ 1. ඞཁͳϝιουͷ࣮૷ FormBaseΛ֦ுͨ͠ϑΥʔϜΫϥεʹ͸getFormID()ɺbuildForm()ɺsubmitForm()ͷ3ͭͷϝιο

    υ͕ඞཁͰ͢ɻ 1. ϑΥʔϜͷදࣔ ࡞੒ͨ͠ϑΥʔϜ͸ϧʔςΟϯάʹొ࿥ͯ͠ϖʔδͱͯ͠දࣔͨ͠ΓɺFormBuilderαʔϏεΛར ༻ͯ͠ϒϩοΫ౳Ͱදࣔͨ͠ΓͰ͖·͢ɻ
  9. ԋश ϑΥʔϜΛ࡞੒ͯ͠ΈΑ͏ʂ 1. ϞδϡʔϧͷσΟϨΫτϦ௚Լʹsrc/Form/MaruchaForm.php ϑΝΠϧΛ ࡞੒ͯ͠ɺϑΥʔϜΫϥεΛ࡞੒͢Δ 2. ඞཁͳϝιουΛ࣮૷͢Δ 3. marucha.routing.ymlϑΝΠϧ಺ʹϧʔςΟϯάΛઃఆ͢Δ

    ίʔυ͸ͪ͜Βˠ https://github.com/hmaruyama/my-drupal9-module/compare/vol4
  10. ϑΥʔϜͷछྨ

  11. ϑΥʔϜͷछྨ ϑΥʔϜΛ࡞੒͢Δʹ͸ \Drupal\Core\Form\FormInterface Λ࣮૷ͨ͠ ϑΥʔϜΫϥε͕ඞཁͰ͢ɻ௚઀FormInterfaceΛ࣮૷͢Δ͜ͱ΋Ͱ͖ ·͕͢ɺForm APIͰ͸ศརͳجఈΫϥε͕3ͭ༻ҙ͞Ε͍ͯ·͢ɻ – FormBas e

    – ConfigFormBas e – ConfirmFormBase ࡞੒͢ΔϑΥʔϜͷ༻్ʹ Ԡͯ͡ɺ͜ΕΒͷجఈΫϥ εΛ֦ுͯ͠ϑΥʔϜΫϥ εΛ࡞੒Ͱ͖·͢ɻ
  12. ֤Ϋϥεͷؔ܎ੑ FormBase ConfigFormBase ConfirmFormBase <<interface>> FormInterface • ConfigFormBas e •

    ConfirmFormBas e ͜ͷೋͭͷΫϥε͸ FormBaseΫϥεΛ֦ு͠· ͢ɻ
  13. ϑΥʔϜͷछྨ - FormBase – FormBaseΫϥε͸ɺҰൠతͳ ϑΥʔϜΛ࡞੒͢Δࡍʹར༻Ͱ ͖·͢ɻ – ྫɿݕࡧϑΥʔϜ –

    FormBaseΫϥε͸ FormInterface Λ࣮૷͍ͯ͠· ͢ɻ
  14. ϑΥʔϜͷछྨ - ConfigFormBase – ConfigFormBaseΫϥε͸ɺγεςϜ ઃఆΛߦ͏ϑΥʔϜΛ࡞੒͢Δࡍʹ ར༻Ͱ͖·͢ɻ – ྫɿαΠτͷجຊઃఆ –

    ConfigFormBaseΫϥε͸
 FormBaseΫϥεΛ֦ு͍ͯ͠·͢ɻ
  15. ϑΥʔϜͷछྨ - ConfirmFormBase – ConfirmFormBaseΫϥε͸ɺ֬ೝը໘Λ࣮૷͍ͨ͠ͱ͖ʹར༻Ͱ͖· ͢ɻ – ྫɿίϯςϯπΞΠςϜͷ࡟আ֬ೝ – ConfirmFormBaseΫϥε͸FormBaseΫϥεΛ֦ு͍ͯ͠·͢ɻ

  16. ϑΥʔϜΫϥεͷϝιου

  17. FormInterfaceͰ༻ҙ͞Ε͍ͯΔϝιου FormInterfaceͰ͸࣍ͷ4ͭͷந৅ϝιου͕ఆٛ͞Ε͍ͯ·͢ɻ FormInterfaceΛ࣮૷͢ΔϑΥʔϜΫϥεͰ͸͜ΕΒͷϝιουͷ࣮૷ ͕ඞਢͰ͢ɻ – getFormId( ) – buildForm( )

    – validateForm( ) – submitForm()
  18. FormInterfaceͰ͸࣍ͷ4ͭͷந৅ϝιου͕ఆٛ͞Ε͍ͯ·͢ɻ FormInterfaceΛ࣮૷͢ΔϑΥʔϜΫϥεͰ͸͜ΕΒͷϝιουͷ࣮૷͕ ඞਢͰ͢ɻ – getFormId( ) – buildForm( ) –

    validateForm() 
 ※FormBaseΫϥεΛ֦ு͢ΔΫϥεͰ͸೚ҙ࣮૷ – submitForm() FormInterfaceͰ༻ҙ͞Ε͍ͯΔϝιου ͜ΕΒͷϝιουͷ࣮૷͕ඞ ਢͰ͕͢ɾɾɾ FormBaseΫϥεͰ͸ validateForm()ͷΈ࣮૷͞Εͯ ͍·͢ɻͳͷͰFormBaseΛ֦ ு͢ΔΫϥεͰ͸ validateForm()ͷΈ೚ҙͰ͢ɻ
  19. getFormId() – ϑΥʔϜʹҰҙͷIDΛ෇༩͠·͢ɻ – ϑΥʔϜʹ͸ඞͣID͕ඞཁͰ͢ɻ – ҰҙੑΛ࣮֬ʹ͢Δʹ͸ɺIDʹϞδϡʔϧͷϚγϯ໊ΛؚΊΔ ͜ͱͰ͢ɻ public function

    getFormId() { return 'marucha_simple_form'; }
  20. buildForm() – $form഑ྻͰHTMLϑΥʔϜΛߏங͠·͢ɻ public function buildForm(array $form, FormStateInterface $form_state) {

    $form['name'] = [ '#type' => 'textfield', '#title' => '໊લ', ]; $form['phone'] = [ '#type' => 'tel', '#title' => 'ి࿩൪߸', ]; $form['submit'] = [ '#type' => 'submit', '#value' => 'อଘ', ]; return $form; }
  21. validateForm() – ஋ͷ௕͞ɺϝʔϧΞυϨεݕূͳͲೖྗ͕ཁ݅Λຬ͍ͨͯ͠Δ͜ͱΛݕূͰ͖·͢ɻ – EmailValidatorαʔϏεͷisValidؔ਺ͰϝʔϧΞυϨεͷݕূ͕ߦ͑·͢ɻ public function validateForm(array &$form, FormStateInterface

    $form_state) { if (strlen($form_state->getValue('phone')) < 3) { $form_state->setErrorByName('phone', '3จࣈҎ্ʹ͍ͯͩ͘͠͞ɻ'); } } Τϥʔϝοηʔδ͕ද ࣔ͞Εɺ֘౰ϑΟʔϧ υ͕੺͘ͳΓ·͢ɻ Ϣʔβʔ͕ૹ৴ͨ͠ϑΥʔϜͷ஋ ͸$form_stateΦϒδΣΫτ͔Β औಘͰ͖·͢ɻ
  22. submitForm() – ϑΥʔϜ͔Βૹ৴͞ΕͨσʔλΛॲཧͰ͖·͢ɻ – σʔλΛσʔλϕʔεʹอଘ͢ΔɺϝʔϧΛૹ৴͢Δɺεςʔλε ϝοηʔδʹදࣔ͢Δɾɾɾ public function submitForm(array &$form,

    FormStateInterface $form_state) { $this->messenger()->addStatus('͝هೖ͋Γ͕ͱ͏͍͟͝·͢ʂ'); }
  23. ϑΥʔϜͷϨϯμϦϯά

  24. ϑΥʔϜ഑ྻͱ͸ – ϑΥʔϜ഑ྻ͸ɺHTMLϑΥʔϜΛߏங͢ΔͨΊͷ࿈૝഑ྻͰ͢ɻ – ཁૉͱଐੑΛ࿈૝഑ྻͰࢦఆ͢Δ͜ͱͰHTMLϑΥʔϜͱͯ͠ϨϯμϦϯά͞Ε·͢ɻ – ϑΥʔϜ഑ྻ͸ཁૉͱଐੑͰߏ੒͞Ε·͢ɻ $form['name'] = [

    '#type' => 'textfield', '#title' => '໊લ', ]; $form['phone'] = [ '#type' => 'tel', '#title' => 'ి࿩൪߸', ]; $form['submit'] = [ '#type' => 'submit', '#value' => 'อଘ', ]; return $form; <form action=.. . <input type=”text” … <input type=”tel” … <input type=”submit”...
  25. ཁૉͱଐੑͷݟ෼͚ํ ཁૉɿ#Ͱ࢝·Βͳ͍ ଐੑɿ#Ͱ࢝·Δ $form['name'] = [ '#type' => 'textfield', '#title'

    => '໊લ', ]; $form['phone'] = [ '#type' => 'tel', '#title' => 'ి࿩൪߸', ]; $form['submit'] = [ '#type' => 'submit', '#value' => 'อଘ', ];
  26. ࢦఆՄೳͳଐੑͷྫ ଐੑ આ໌ ࢦఆྫ #type ཁૉͷλΠϓ '#type' => 'textfield' #title

    ཁૉͷλΠτϧ '#title' => '໊લ' #description ཁૉΛઆ໌͢ΔͨΊͷςΩετ '#description' => '໊લΛೖྗͯ͘͠ ͍ͩ͞ɻ' #required ཁૉ͕ೖྗඞਢ͔Ͳ͏͔ '#required' => TRUE ଞʹ΋୔ࢁ͋Γ·͢ɻৄࡉ͸ͪ͜ΒΛ͝ཡ͍ͩ͘͞ɻ https://www.drupal.org/docs/drupal-apis/form-api/form-render-elements
  27. ࢦఆՄೳͳtypeଐੑͷ஋ ஋ આ໌ ϨϯμϦϯάྫ textfield 1ߦͷςΩετϑΟʔϧυ <input type=”text”... number ਺஋ೖྗͷͨΊͷϑΟʔϧυ

    <input type=”number”... radio / radios ୯Ұ or ෳ਺ͷϥδΦϘλϯ <input type=”radio”... email ϝʔϧΞυϨεೖྗͷͨΊͷϑΟʔϧυ <input type=”email”... tel ి࿩൪߸ೖྗͷͨΊͷϑΟʔϧυ <input type=”tel”... hidden ը໘্ʹ͸දࣔ͞Εͳ͍Ӆ͠σʔλ <input type=”hidden”... submit ϑΥʔϜͷૹ৴Ϙλϯ <input type=”submit”... ଞʹ΋୔ࢁ͋Γ·͢ɻৄࡉ͸ͪ͜ΒΛ͝ཡ͍ͩ͘͞ɻ https://api.drupal.org/api/drupal/elements https://drupalize.me/tutorial/form-element-reference
  28. ԋश ϑΥʔϜ഑ྻΛۦ࢖ͯ͠৭ΜͳϑΟʔϧυΛ࡞ͬͯΈΑ͏ʂ – ϝʔϧΞυϨεϑΟʔϧυ – ి࿩൪߸ϑΟʔϧυ – ϥδΦϘλϯϑΟʔϧυ – νΣοΫϘοΫεϑΟʔϧυ

    – બ୒ϑΟʔϧυ – ΧϥʔϑΟʔϧυ ίʔυ͸ͪ͜Βˠ https://github.com/hmaruyama/my-drupal9-module/compare/vol4
  29. ϑΥʔϜͷऔಘͱදࣔ

  30. ࡞੒ͨ͠ϑΥʔϜΛදࣔ͢Δ ࡞੒ͨ͠ϑΥʔϜΛදࣔ͢Δํ๏͸ओʹ2ͭ͋Γ·͢ɻ – ϑΥʔϜΫϥεΛϧʔςΟϯάγεςϜʹొ࿥͢Δ – FormBuilderαʔϏεͰϑΥʔϜΛऔಘ͢Δ

  31. ϑΥʔϜΫϥεΛϧʔςΟϯάγεςϜʹొ࿥͢Δ _formΩʔʹϑΥʔϜΫϥεΛࢦఆ͢Δ͜ͱͰɺϧʔςΟϯάγεςϜʹొ࿥Ͱ͖ ·͢ɻ͜ΕʹΑͬͯɺࢦఆͨ͠URLύεʹԠͯ͡ϑΥʔϜΛऔಘɺදࣔͰ͖·͢ɻ marucha.form: path: '/marucha/form' defaults: _title: 'Marucha form'

    _form: '\Drupal\marucha\Form\MaruchaForm' requirements: _permission: 'access content' ίϯτϩʔϥʔΫϥεͷ৔ ߹͸ Class::methodͷܗࣜ Ͱهड़͠·͕ͨ͠ɺϑΥʔ ϜΫϥε͸Ϋϥε໊ͷΈΛ ࢦఆ͠·͢ɻ
  32. FormBuilderαʔϏεͰϑΥʔϜΛऔಘ͢Δ Form APIͰ͸ɺϑΥʔϜͷऔಘͱॲཧʹ࢖༻Ͱ͖Δ FormBuilder αʔϏε͕ ༻ҙ͞Ε͍ͯ·͢ɻ ͜ͷαʔϏεΛར༻͢Δ͜ͱͰɺϒϩοΫ౳ͷϧʔτ֎ͰϑΥʔϜͷऔಘͱ ද͕ࣔߦ͑·͢ɻ class MaruchaBlock

    extends BlockBase { public function build() { return \Drupal::formBuilder()->getForm('Drupal\marucha\Form\MaruchaForm'); } }
  33. ԋश ϑΥʔϜΛϒϩοΫʹදࣔͯ͠ΈΑ͏ʂ 1. ϑΥʔϜΫϥεΛ࡞੒͢Δ 2. ϒϩοΫΫϥεΛ࡞੒ͯ͠ɺϒϩοΫΫϥε಺ͰFormBuilder αʔϏεΛ࢖༻ͯ͠ϑΥʔϜΛऔಘ͢Δ 3. Drupal؅ཧը໘͔Β ϒϩοΫϨΠΞ΢τ

    ʹҠಈͯ͠೚ҙͷ Ϧʔδϣϯʹ࡞੒ͨ͠ϒϩοΫΛ഑ஔ͢Δ ίʔυ͸ͪ͜Βˠ https://github.com/hmaruyama/my-drupal9-module/compare/vol4
  34. ϑΥʔϜͷมߋ

  35. ϑΥʔϜͷมߋ طଘͷϑΥʔϜΛมߋ͢Δ৔߹ɺϑοΫͰߦ͍·͢ɻForm API͔ΒϑΥʔϜΛม ߋ͢ΔͨΊͷϑοΫ͕ఏڙ͞Ε͍ͯ·͢ɻ
 – hook_form_alter()ɿ༷ʑͳϑΥʔϜΛಉ࣌ʹมߋ͍ͨ͠ͳͲ – hook_form_FORM_ID_alter()ɿ୯ҰͷϑΥʔϜΛมߋ͢Δ

  36. ࿅श໰୊

  37. ࿅श໰୊1 ࣍ͷΑ͏ͳϑΥʔϜΫϥεΛ࡞੒ͨ͠ͱ͜Ζɺ Fatal error͕ൃੜ͠·ͨ͠ɻߟ͑ΒΕΔݪҼ͸Ͳ ΕͰ͔͢ʁ 1. ࣮૷͢΂͖ϝιου͕࣮૷͞Ε͍ͯͳ͍ɻ 2. ະ࢖༻ͷม਺͕͋Δɻ 3.

    αʔϏε΁ͷΞΫηεʹάϩʔόϧؔ਺͕ ࢖༻͞Ε͍ͯΔɻ 4. ഑ྻͷࢦఆʹ [ ] Ͱ͸ͳ͘ array() ͕࢖༻͞ Ε͍ͯΔɻ class MaruchaForm extends FormBase { public function buildForm(array $form, FormStateInterface $form_state) { $form['name'] = array( '#type' => 'textfield', '#title' => '໊લ', ); $form['submit'] = array( '#type' => 'submit', '#value' => 'อଘ', ); return $form; } public function validateForm(array &$form, FormStateInterface $form_state) { if (mb_strlen($form_state->getValue('name')) < 3) { $form_state->setErrorByName('name', '3จࣈҎ্ʹ͍ͯͩ͘͠͞ɻ'); } } public function submitForm(array &$form, FormStateInterface $form_state) { \Drupal::messenger()->addStatus('͝هೖ͋Γ͕ͱ͏͍͟͝·͢ʂ'); } }
  38. ࿅श໰୊1 ࣍ͷΑ͏ͳϑΥʔϜΫϥεΛ࡞੒ͨ͠ͱ͜Ζɺ Fatal error͕ൃੜ͠·ͨ͠ɻߟ͑ΒΕΔݪҼ͸Ͳ ΕͰ͔͢ʁ 1. ࣮૷͢΂͖ϝιου͕࣮૷͞Ε͍ͯͳ͍ɻ 2. ະ࢖༻ͷม਺͕͋Δɻ 3.

    αʔϏε΁ͷΞΫηεʹάϩʔόϧؔ਺͕ ࢖༻͞Ε͍ͯΔɻ 4. ഑ྻͷࢦఆʹ [ ] Ͱ͸ͳ͘ array() ͕࢖༻͞ Ε͍ͯΔɻ class MaruchaForm extends FormBase { public function buildForm(array $form, FormStateInterface $form_state) { $form['name'] = array( '#type' => 'textfield', '#title' => '໊લ', ); $form['submit'] = array( '#type' => 'submit', '#value' => 'อଘ', ); return $form; } public function validateForm(array &$form, FormStateInterface $form_state) { if (mb_strlen($form_state->getValue('name')) < 3) { $form_state->setErrorByName('name', '3จࣈҎ্ʹ͍ͯͩ͘͠͞ɻ'); } } public function submitForm(array &$form, FormStateInterface $form_state) { \Drupal::messenger()->addStatus('͝هೖ͋Γ͕ͱ͏͍͟͝·͢ʂ'); } }
  39. ࿅श໰୊2 ΧελϜϞδϡʔϧ಺Ͱ࡞੒ͨ͠ϑΥʔϜΛϒϩοΫʹදࣔ͢Δʹ͸Ͳͷํ ๏͕ར༻Ͱ͖·͔͢ʁ 1. *.moduleϑΝΠϧͰhook_form_FORM_ID_alter()Λ࣮૷ͯ͠ϑΥʔϜΛ औಘ͢Δɻ 2. ϒϩοΫΫϥε಺Ͱdrupal_get_form()Λ࢖༻ͯ͠ϑΥʔϜΛऔಘ͢Δɻ 3. ϒϩοΫΫϥε಺ͰFormBuilderαʔϏεΛ࢖༻ͯ͠ϑΥʔϜΛऔಘ͢

    Δɻ
  40. ࿅श໰୊2 ΧελϜϞδϡʔϧ಺Ͱ࡞੒ͨ͠ϑΥʔϜΛϒϩοΫʹදࣔ͢Δʹ͸Ͳͷํ ๏͕ར༻Ͱ͖·͔͢ʁ 1. *.moduleϑΝΠϧͰhook_form_FORM_ID_alter()Λ࣮૷ͯ͠ϑΥʔϜΛ औಘ͢Δɻ 2. ϒϩοΫΫϥε಺Ͱdrupal_get_form()Λ࢖༻ͯ͠ϑΥʔϜΛऔಘ͢Δɻ 3. ϒϩοΫΫϥε಺ͰFormBuilderαʔϏεΛ࢖༻ͯ͠ϑΥʔϜΛऔಘ͢

    Δɻ
  41. ࿅श໰୊3 ίΞͰఏڙ͞Ε͍ͯΔϑΥʔϜͷ಺༰ΛΧελϜϞδϡʔϧଆͰมߋ ͍ͨ͠Ͱ͢ɻ࣍ͷ͏ͪద੾ͳํ๏Λ1ͭબ୒͍ͯͩ͘͠͞ɻ 1. ίΞΛϋοΫ͢Δɻ 2. hook_form_FORM_ID_alter()Λ࣮૷ͯ͠ϑΥʔϜΛ্ॻ͖͢Δɻ 3. FormBuilderαʔϏεͷgetForm()Λ࢖༻ͯ͠ϑΥʔϜΛ্ॻ͖͢ Δɻ

  42. ࿅श໰୊3 ίΞͰఏڙ͞Ε͍ͯΔϑΥʔϜͷ಺༰ΛΧελϜϞδϡʔϧଆͰมߋ ͍ͨ͠Ͱ͢ɻ࣍ͷ͏ͪద੾ͳํ๏Λ1ͭબ୒͍ͯͩ͘͠͞ɻ 1. ίΞΛϋοΫ͢Δɻ 2. hook_form_FORM_ID_alter()Λ࣮૷ͯ͠ϑΥʔϜΛ্ॻ͖͢Δɻ 3. FormBuilderαʔϏεͷgetForm()Λ࢖༻ͯ͠ϑΥʔϜΛ্ॻ͖͢ Δɻ

  43. ຊ೔ͷΞδΣϯμ͸ऴྃ

  44. ΞδΣϯμ 1. DrupalͷForm APIͱ͸ 2. ϑΥʔϜͷछྨ 3. ϑΥʔϜΫϥεͷϝιου 4. ϑΥʔϜͷϨϯμϦϯά

    5. ϑΥʔϜͷऔಘͱදࣔ 6. ϑΥʔϜͷมߋ 7. ࿅श໰୊
  45. None