FormAPI, AJAX and Node.js

Similar documents
CS396A UGP Presentation. Dr. Prabhakar T.V

(An) Optimal Drupal 7 Module Configuration for Site Performance JOE PRICE

HYBRID. Course Packet

Develop a Native App (ios and Android) for a Drupal Website without Learning Objective-C or Java. Drupaldelphia 2014 By Joe Roberts

Sitecore Dashboard User Guide

MASTER DRUPAL 7 MODULE DEVELOPMENT

Developing ASP.NET MVC 4 Web Applications MOC 20486

How does Drupal 7 Work? Tess Flynn, KDØPQK

Speed up your web site. Alan Seiden Consulting alanseiden.com

Drupal CMS for marketing sites

MEAN/Full Stack Web Development - Training Course Package

MASTERTAG DEVELOPER GUIDE

Drupal and ArcGIS Yes, it can be done. Frank McLean Developer

How To Write A Web Server In Javascript

A Model of the Operation of The Model-View- Controller Pattern in a Rails-Based Web Server

Vincent Gabriel. Summary. Experience. Senior Software Developer at Landmark Network

Example. Represent this as XML

Developing ASP.NET MVC 4 Web Applications

Design ï Development ï Digital Marketing ï Content

CiviCRM for Drupal Developers

Performance Testing for Ajax Applications

Art of Code Front-end Web Development Training Program

Everything you ever wanted to know about Drupal 8*

Avaya Inventory Management System

Developing ASP.NET MVC 4 Web Applications Course 20486A; 5 Days, Instructor-led

An introduction to creating Web 2.0 applications in Rational Application Developer Version 8.0

Hack-proof Your Drupal App. Key Habits of Secure Drupal Coding

JAVASCRIPT, TESTING, AND DRUPAL

The truth about Drupal

A Web- based Approach to Music Library Management. Jason Young California Polytechnic State University, San Luis Obispo June 3, 2012

Software Development & Education Center PHP 5

X-POS GUIDE. v3.4 INSTALLATION SmartOSC and X-POS

Zapper for ecommerce. Magento Plugin Version Checkout

Creating a Drupal 8 theme from scratch

Faichi Solutions. The Changing Face of Drupal with Drupal 8

Auditing Drupal sites for performance, content and optimal configuration

Subject Tool Remarks What is JQuery. Slide Javascript Library

ultimo theme Update Guide Copyright Infortis All rights reserved

Modern Web Development From Angle Brackets to Web Sockets

IBM Digital Experience. Using Modern Web Development Tools and Technology with IBM Digital Experience

Installation, Configuration, and Usage

The Learn-Verified Full Stack Web Development Program

Learning Web App Development

Adding Panoramas to Google Maps Using Ajax

IBM Script Portlet for WebSphere Portal Release 1.1

Drupal Training Modules 2015

Lucy Zhang UI Developer Contact:

DROPFILES SUPPORT. Main advantages:

Lecture 9 Chrome Extensions

Wildix Kite. Quick Guide

Programming in HTML5 with JavaScript and CSS3

Cache All The Things

Client-Side Web Programming (Part 2) Robert M. Dondero, Ph.D. Princeton University

Drupal 8 Theming Deep Dive

Upgrade to Microsoft Web Applications

Node.js, MongoDB and AngularJS Web Development

DreamFactory & Modus Create Case Study

RIA Technologies Comparison

5 Mistakes to Avoid on Your Drupal Website

MODERN WEB APPLICATION DEVELOPMENT WORKFLOW

Content Management System

Preparing Your Business for Magento 2.0

Google Web Toolkit (GWT) Architectural Impact on Enterprise Web Application

Project Proposal. Developing modern E-commerce web application via Responsive Design

Login and Pay with Amazon - extension for Magento

place/business fetch details, removefromfavorite () function, 189 search button handler bind, B BlackBerry build environment

JTouch Mobile Extension for Joomla! User Guide

NoSQL web apps. w/ MongoDB, Node.js, AngularJS. Dr. Gerd Jungbluth, NoSQL UG Cologne,

ICON UK 2015 node.js for Domino developers. Presenter: Matt White Company: LDC Via

Visualizing a Neo4j Graph Database with KeyLines

Project Orwell: Distributed Document Integrity Verification

Shop Manager Manual ConfigBox 3.0 for Magento

Add Munchkin Tracking Code to Your Website

Advanced Web Development SCOPE OF WEB DEVELOPMENT INDUSTRY

Who? Wolfgang Ziegler (fago) Klaus Purer (klausi) Sebastian Gilits (sepgil) epiqo Austrian based Drupal company Drupal Austria user group

Abdullah Radwan. Target Job. Work Experience (9 Years)

Beyond The Web Drupal Meets The Desktop (And Mobile) Justin Miller Code Sorcery Workshop, LLC

Visualizing an OrientDB Graph Database with KeyLines

Software development & technologies in Market Research industry

Paul Boisvert. Director Product Management, Magento

SUBJECT CODE : 4074 PERIODS/WEEK : 4 PERIODS/ SEMESTER : 72 CREDIT : 4 TIME SCHEDULE UNIT TOPIC PERIODS 1. INTERNET FUNDAMENTALS & HTML Test 1

HOW TO CREATE THEME IN MAGENTO 2

AJAX. Gregorio López López Juan Francisco López Panea

Developing Cross-platform Mobile and Web Apps

Responsive, resilient, elastic and message driven system

JavaScript Client Guide

Z-Way Home Automation User Interface Documentation. (c) Z-Wave.Me Team, based on Version 2.0

Drupal 8. Core and API Changes Shabir Ahmad MS Software Engg. NUST Principal Software Engineser PHP/Drupal

Wildix WebRTC Kite & MCU Videoconference. Quick Start Guide

JavaScript Programming

GUI and Web Programming

Transcription:

FormAPI, AJAX and Node.js Overview session for people who are new to coding in Drupal. Ryan Weal Kafei Interactive Inc. http://kafei.ca These slides posted to: http://verbosity.ca

Why? New developers bring their knowledge from other web apps, but in many cases Drupal is different Learning these «Drupal-isms» will help make your life easier

What makes Drupal different? <form> tags are not allowed! JavaScript is done on the field level in many cases Adding JS libraries is common Sometimes DrupalJS has limits.

Where is JavaScript used in Drupal? In forms where users input their data FormAPI Packaged in themes and modules which provide front-end functionality DrupalAPI When we communicate with remote systems AJAX / JSON

FormAPI What is it? Library of re-usable form elements https://api.drupal.org/api/drupal/developer!topics!forms_ Easy way to add JS to forms Customizable override any Drupal form Flexible : store values between pages, etc.

FormAPI Making forms Just a PHP function in a custom module You can call the code with drupal_get_form() or by created a hook_menu() Use «devel» module for debugging forms by wrapping the variable in dpm($form);

FormAPI Overrides make life easy Use standard Drupal structures like node and user, and simply override the things you need Change form widgets, add CSS, JS, redirects, etc. Put descriptive text into a form

FormAPI Better than <form> No «submit» URL : all Drupal forms typically submit back to the same page (self) All forms on a page get submitted if ANY submit button is clicked Easy to override redirect destinations Plays nice with caching

FormAPI Meet AJAX Just add a component to your field with a PHP function name Your PHP function can do things like replace #id and.class RELOAD the same form as part of the replacement dynamic forms!

AJAX Callbacks What are they? Just a regular Drupal PHP function that returns a JSON object Needs a special hook_menu entry so that the system does not try to render pages at same time The system still loads a ton of Drupal code to do the reply

Front-end JavaScript Use an exsiting module? Custom in the theme? Custom in the module?

Front-end JavaScript : Adding custom code Load the code using drupal_add_js in your module or theme

Front-end JavaScript : communicating with PHP Mixing PHP with client JS : Settings array!

Front-end JavaScript : behaviors Respond to Drupal events

Front-end JavaScript: Mixing in libraries Find an existing module? Roll it yourself : wrap it up! Run multiple versions of jquery! Prevent your code from conflicting with others

Front-end JavaScript: limitations Want to build a chat system in Drupal? Need asyncronous data? Displaying fresh data in real-time

Back-end JavaScript: what is it? Chrome's JavaScript engine is used to compile JS Most of the projects have nothing to do with front-end JS The best thing it does is «real-time» applications which are asynchronous

Back-end JavaScript: the techology stack Node.js Firewall Node.js + NoSQL (JS databases) Drupal Firewall Apache / Nginx PHP Drupal JavaScript

Back-end JavaScript: why not both? Keep a «live» connection between the server and your users Stop polling the server! Use socket.io Drupal node.js module maintains relationship with user account

Node.js : how it works (with Drupal) Adds a socket.io JavaScript embedded in the webpage Connects to a node.js server that is connected to Drupal Spools information to and from Drupal and the user Define #id and.class regions that will receive data from node.js

Node.js : how to integrate Install node.js on your server/system Add «nodejs» Drupal contrib module to your site Edit the server.js file Run node from sites/all/modules/nodejs

When to use each technology : Only need to update fields FormAPI Need to do general JavaScript on a page include a.js file in your code base, wrapped Asyncronous / real-time / not-cachable data node.js

Resources Form API Reference : https://api.drupal.org/api/drupal/developer!topics!for The Drupal JavaScript API : https://www.drupal.org/node/304258 Node.js contrib module : https://www.drupal.org/project/nodejs

FormAPI, AJAX and Node.js Overview session for people who are new to coding in Drupal. Ryan Weal Kafei Interactive Inc. http://kafei.ca These slides posted to: http://verbosity.ca