Future Proofing Your
Drupal Skills
Piyuesh Kumar
QED42

1
AGENDA:

• Drupal 8 Api Changes:
• Module info file
• Routing System
• Drupal 8 CMI & Using Config inspector
• Basic chang...
Info File

•Info files changed to info.yml
•Old info file: {d7.info}

•New info file: {d8.info.yml}

3
Warning:
Things are about to get...
geeky.

4
ROUTING SYSTEM

• d7(hook_menu):

5
D8 ROUTING
SYSTEM(HOOK_MENU)

• d8 conversion(hook_menu):
• Hook_menu Lives..:)

6
D8 ROUTING
SYSTEM(ROUTING.YML)

• d8 conversion:
• Callbacks and permissions are defined in a yml
file.{d8.routing.yml}

7
D8 ROUTING SYSTEM(WRITING
CONTROLLERS)

• d8 conversion:
• Writing Page Callbacks

8
D8 ROUTING SYSTEM(CORE
CONTROLLERS)

• _form
• _content
• _controller
• _entity_form
• _entity_list
• and many more..

9
CONFIGURATION SCHEMA

• R.I.P variable-get/variable_set

10
CONFIGURATION SCHEMA

•When would Config data get saved?

• UI changes (automatic): When the save button

is clicked on an...
CMI(EXAMPLE)

•D7:
•D8:

12
USING CONFIG INSPECTOR

• https://drupal.org/project/config_inspector/gitinstructions

13
WRITING FORMS AND THEIR SUBMIT
HANDLERS IN D8

•FormInterface(https://api.drupal.org/api/drupal/co
re!lib!Drupal!Core!Form...
EXAMPLE

• D7:

15
• D8:

EXAMPLE

16
D8 FORMS(VALIDATION &
SUBMISSION)
•function validateForm(array &$form, array
&$form_state) {}

•function submitForm(array ...
D8
FORMS(SYSTEM_SETTINGS_FORM
??)
• Extends SystemConfigFormBase:

18
D8 FORMS(OTHER EXTENDABLE
CLASSES IN CORE)

• ConfirmFormBase(https://api.drupal.org/api/drupal/core!lib!Dru
pal!Core!Form...
Basic Function from d7 to d8
• hook_init removed(https://drupal.org/node/2013014)
• Module/hook system functions replaced ...
21
Upcoming SlideShare
Loading in …5
×

Future proof your drupal skills - Piyuesh Kumar

1,826 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,826
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Future proof your drupal skills - Piyuesh Kumar

  1. 1. Future Proofing Your Drupal Skills Piyuesh Kumar QED42 1
  2. 2. AGENDA: • Drupal 8 Api Changes: • Module info file • Routing System • Drupal 8 CMI & Using Config inspector • Basic changes to oftenly uses Drupal functions. • Writing forms and their submit handlers in d8 • Live Demo of Porting a Drupal 7 module to Drupal 8. 2
  3. 3. Info File •Info files changed to info.yml •Old info file: {d7.info} •New info file: {d8.info.yml} 3
  4. 4. Warning: Things are about to get... geeky. 4
  5. 5. ROUTING SYSTEM • d7(hook_menu): 5
  6. 6. D8 ROUTING SYSTEM(HOOK_MENU) • d8 conversion(hook_menu): • Hook_menu Lives..:) 6
  7. 7. D8 ROUTING SYSTEM(ROUTING.YML) • d8 conversion: • Callbacks and permissions are defined in a yml file.{d8.routing.yml} 7
  8. 8. D8 ROUTING SYSTEM(WRITING CONTROLLERS) • d8 conversion: • Writing Page Callbacks 8
  9. 9. D8 ROUTING SYSTEM(CORE CONTROLLERS) • _form • _content • _controller • _entity_form • _entity_list • and many more.. 9
  10. 10. CONFIGURATION SCHEMA • R.I.P variable-get/variable_set 10
  11. 11. CONFIGURATION SCHEMA •When would Config data get saved? • UI changes (automatic): When the save button is clicked on an admin page, data gets written to the active store as well as db. • Code changes (manual): use admin/config/development/sync to sync the config in code with db and active store. 1
  12. 12. CMI(EXAMPLE) •D7: •D8: 12
  13. 13. USING CONFIG INSPECTOR • https://drupal.org/project/config_inspector/gitinstructions 13
  14. 14. WRITING FORMS AND THEIR SUBMIT HANDLERS IN D8 •FormInterface(https://api.drupal.org/api/drupal/co re!lib!Drupal!Core!Form!FormInterface.php/interfac e/FormInterface/8) •SystemConfigFormBase(http://drupalcontrib.org/ api/drupal/drupal!core!modules!system!lib!Drupal!sys tem!SystemConfigFormBase.php/class/SystemC onfigFormBase/8) 14
  15. 15. EXAMPLE • D7: 15
  16. 16. • D8: EXAMPLE 16
  17. 17. D8 FORMS(VALIDATION & SUBMISSION) •function validateForm(array &$form, array &$form_state) {} •function submitForm(array &$form, array &$form_state) {} 17
  18. 18. D8 FORMS(SYSTEM_SETTINGS_FORM ??) • Extends SystemConfigFormBase: 18
  19. 19. D8 FORMS(OTHER EXTENDABLE CLASSES IN CORE) • ConfirmFormBase(https://api.drupal.org/api/drupal/core!lib!Dru pal!Core!Form!ConfirmFormBase.php/class/ConfirmFormBase/ 8) • BulkFormBase(https://api.drupal.org/api/drupal/core!modules!sy stem!lib!Drupal!system!Plugin!views!field!BulkFormBase.php/8) • FieldInstanceFormBase • ViewsFormBase(https://api.drupal.org/api/drupal/core!modules!vi ews_ui!lib!Drupal!views_ui!Form!Ajax!ViewsFormBase.php/class/V iewsFormBase/8) 19
  20. 20. Basic Function from d7 to d8 • hook_init removed(https://drupal.org/node/2013014) • Module/hook system functions replaced with module handler service(https://drupal.org/node/1894902) • drupal_goto has been removed(https://drupal.org/node/2023537) • hook_boot has been removed(https://drupal.org/node/1909596) • $_GET[‘q'] has been removed(https://drupal.org/node/1659562) • For more goto https://drupal.org/list-changes 20
  21. 21. 21

×