Examples for Developer #9 Week of Coding

Submitted by Abhishek Lal B on Wed, 08/02/2017 - 20:39
Gsoc pic

Well, had an awesome time with the second evaluation and I was able to complete it, I would like to thank my mentors Navneet Singh and Vaibhavjain for making this happen (In this evaluation process, set up by GSoC organisers, students and mentors have to share their feedback about the current progress of the project. Mentors need to give a pass/ fail grade. Students can continue coding once they clear the evaluations successfully). Well, I learned a lot and I thank this initiative, so that could explore deep of more technologies, version control systems as part of my project in Drupal.

I have been porting Examples for Developers from Drupal 7 to Drupal 8 and currently, I was able to port,

Menu Example :- The Drupal 7 menu system revolved around hook_menu(), which provided associations between paths and callback functions (controllers) and also served as a central place to provide menu items in different menus (mostly in the administration menu) associated with the paths, as well as providing tabs and action links on pages and contextual links for different paths. It also did access checking, entity loading, and so on and on. That is a lot to handle for one system. In Drupal 8, these areas of functionality are now separated into different systems. The association of a path with a controller, coupled with parameter upcasting and access checking, is now handled in the routing system. This system serves as a basis for path access on a Drupal 8 site. The Drupal 8 menu system is now a collection of different APIs for menu items defined by modules as well as local tasks, actions and contextual links.

Contextual Example:- Some modules supply contextual links that allow privileged users to quickly perform tasks that are related to regions of the page without navigating to the Admin Dashboard. For example, when you hover your mouse over a block or node, links are displayed that allow you to make changes to the block or node. Contextual links have also been moved out of the hook_menu() system in Drupal 8 and are very similar to local tasks. Use contextual links to provide contextual operations to users around common Drupal objects appearing on the frontend.

Ajax Example:- AJAX stands for Asynchronous JavaScript and XML. AJAX is a new technique for creating better, faster, and more interactive web applications with the help of XML, HTML, CSS, and Java Script. With AJAX, when you hit submit, JavaScript will make a request to the server, interpret the results, and update the current screen. In the purest sense, the user would never know that anything was even transmitted to the server.

Please refer my previous blog post and my GitHub repo to know more about my projects.

Last week I've had been working with the Ajax Example and also with the Contextual Example, currently contextual examples have reached its final stages but It needs few more finishing touch well that was my target during these days. I was improving the code of AJAX as per the instruction from my mentor like adding translatable template etc.

template fig 2.1: Description text for AJAXImage removed.

controller
fig 2.2:calling it inside the controller

Currently, I am working with Wizard example of the AJAX and I am stuck with it, well I think the form(fig 2.3) value is not incrementing properly and I am confident with my Ajax part is accordingly.

form AJAX
fig 2.3: form Code

 

wizard
Wizard example -AJAX

This is the current working state of my wizard module, non techically the next button is not working properly even if it does, I am not able to go back, well the form['step'] is actually tell which page should I go when the button is clicked and the AJAX is only returning form.

Well, like the famous scientist Thomas Alva Edison said "I have not failed. I've just found 10,000 ways that won't work." like the I've found few ways in which this won't work. This week I will be concentrating  on the current errors which I am facing with AJAX and will try to resolve it be the next week.

Tags