Introduction to Module Development Yi Zhang & Nikki Massaro Kauffman.

Slides:



Advertisements
Similar presentations
» PHP arrays are lists of values stored in key-value pairs. » Uses of arrays: Many built-in PHP environment variables. Database functions use arrays.
Advertisements

Easily retrieve data from the Baan database
A brief overview of Drupal 7 By Robin Isard, Systems Librarian Algoma University.
Drupal Basics Part 3 Create a new page Main tabs menu Using the theme Agricultural Communications Services Integrated Media Training Sessions
EFRONT V4 EXTENSIONS ARCHITECTURE. The goal  To offer more flexibility to 3 rd party users to modify eFront functionality  To further extend eFront.
Seattle Drupal Clinic Introduction to Drupal and Web Content Management.
“Drupal is written in PHP, which is uttterly offensive to people.” H o r r i b l e T r u t h 1.
Drupal Online Tutorial A Product of an ENGL 421 class at Purdue University Page 1.
Our aims ease the pain – for all our users get with the times better communication with our supporters recruit and engage people to our campaigns raise.
By Alex Loescher Robert Partch and Robert Pimentel 1.
Drupal Create a website/web app quickly with this Content Management System Jiaying Xu Spring 2011 COMS E6125 Web-enHanced Information.
New Student Orientation Registration System Stephen Nakamura EE496 Final Presentation Fall 2008.
The Dr ü G Book: An Intro to Drupal The Dr ü G Book: An Intro to Drupal (Dr ü G: Drupal User ’ s Group - users, not developers) This is an introduction.
Drupal Workshop Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology, Drupal technology, directories.
Walking the walk and talking the talk… T HE L ANGUAGE OF D RUPAL.
The 12 screens to follow contain a number of Tool descriptions, some instructions on their use, and in some cases a Task or two. If you dedicate one hour.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
The Drupal 6 menu system: architecture, do, don't and tricks (part 1) Peter Wolanin August 27, 2008 Drupalcon, Szeged.
Installing CiviCRM onto Wordpress. How does it work?
TOP 20 MISTAKES YOU WILL MAKE IN YOUR 1ST DRUPAL PROJECT IZTOK SMOLIČ, ZAGREB.
Introduction: Drupal is a free and open-source content management system (CMS). A content management system(CMS) is a computer program that allows publishing,
1/30/11 Hacking your way through the Drupal API, a themers intro Baris Wanschers (BarisW)
SCHOOL OF INFORMATION UNIVERSITY OF MICHIGAN si.umich.edu Drupal: Configuration and Customization Week 4: Installation, Module Development January 25,
Drupal Training Syllabus Chaitanya Lakshmi
How to extend and configure Drupal without user interaction or database dump By Damien Snoeck for Switzerland Romandy Drupal Group January 27, 2010 Work.
LATTICE TECHNOLOGY, INC. For Version 10.0 and later XVL Web Master Advanced Tutorial For Version 10.0 and later.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Creating a Web Site to Gather Data and Conduct Research.
Entities in Drupal 7 & the Entity API #sudrupalcamp April 6, 2013 JD Leonard ModernBizConsulting.com ModernBizConsulting.com ModernBizConsulting.com.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
Multi-Part Requests/ Parent & Child Service Items.
Project Implementation for COSC 4120 Database Applications Lab 3.
Managing Drupal with Aegir Chris Burge Burge Consulting, LLC 30 June 2013 Dublin, Ireland Drupal Dev Days.
Drupal Commerce Better than Uber Andrew Root: druroot.
We Know IT … IT’s What We Do! ® 2 Cyprien Mvuanda & Jonathan Davis Empire 2.0 Services October 1, 2010 Albany, NY Design, Development,Workflow and Implementation.
Drupal Overview Prepared by : Agustin D. Gumogda Jr. Instructor.
Friend Connect Integration. WordPress Open source blog engine PHP / MySQL based Completely customizable Plugin friendly.
Introduction to Omeka. What is Omeka? - An Open Source web publishing platform - Used by libraries, archives, museums, and scholars through a set of commonly.
Seattle Drupal Clinic Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology.
Introduction to Module Development John Fiala and Ezra Barnett Gildesgame.
Entities in Drupal 7 & the Entity API #sfdug March 11, 2013 JD Leonard ModernBizConsulting.com.
Introduction to Perl Part III By: Bridget Thomson McInnes 6 Feburary 2004.
How does Drupal Work? Information Systems 337 Prof. Harry Plantinga.
Introduction to Views Stanford Drupal Camp April 6, 2013.
Drupal for client Maria Sherskova skype: sherskova.
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
Table of Contents TopicSlide Administrator Login 2 Administrator Navigations 3 Managing AlternativeDr.com Blogs 4 Managing Dr. Lloyd May Blogs 5 Managing.
Strictly Business Using “StrictlyFused” to Create an Extensible Knowledge Portal.
Chaos tool suite's Form wizard tool. Who am I? oadaeh d.o UID: 4649 (10 years 1 month) Mass Contact, Basic webmail Live in: Las Vegas, NV Organizer of.
 Shopping Basket  Stages to maintain shopping basket in framework  Viewing Shopping Basket.
Drupal Recipe: Before and After Gallery Lisa Forgan and Chris Neglia, using notes from Drupal Camp Colorado Copyright 2009, Page 1 Solutions LLC.
Centralized Settings for Noxturnal  How to manage Noxturnal‘s Default Settings through Noxturnal Administrator mode  How to centralize Noxturnal settings.
SimpleVocab An OMEKA Plug-In. WHAT IS simplevocab With Simple Vocab you can create and define a controlled vocabulary for any field using a simple interface.With.
We Behatin’. INTRODUCTION Behat background 3 Behat prep Getting started
Module of the week Webform 7.x-4.0-alpha9 – admin/config/content/webform Add content types, choose allowed fields, default values and advanced options.
Joomla Awdhesh Kumar Singsys Pte Ltd. What is Joomla? Joomla is an award-winning content management system (CMS), which enables you to build Web sites.
How to use Drupal Awdhesh Kumar (Team Leader) Presentation Topic.
Introduction To Simple WordPress Plugin Development
Creating a Theme From Scratch in Drupal
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
Introduction to Dynamic Web Programming
How to change the LOGO on PecStarWeb V3.6
TOPSpro Special Topics
Easily retrieve data from the Baan database
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
PHP Training at GoLogica in Bangalore
SiteBuilder 2 Introduction.
Importance of logs in custom development
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

Introduction to Module Development Yi Zhang & Nikki Massaro Kauffman

Modules Use PHP to customize Drupal. Can access variables used in Drupal Core. Can override/enhanc e core functions through “hooks”.

Use them wisely…

…or you may have conflicts.

Why Module Development? Content Types ViewsThemesModules GUI Code DataPresentation Data

Where Modules Live sites/ all/ modules/ contrib/ custom/ themes/

Where Modules Live sites/ all/ modules/ contrib/ custom/ themes/

Where Modules Live sites/ all/ modules/ contrib/ custom/ themes/ 3 rd party modules

Where Modules Live sites/ all/ modules/ contrib/ custom/ themes/ DIY modules

Recipe for a Module Ingredients.info.module optional files optional folders

Recipe for a Module Ingredients.info – module info, files, and dependencies.module optional files optional folders

Recipe for a Module Ingredients.info – module info, files, and dependencies.module – function of the module optional files optional folders

Recipe for a Module Ingredients.info – module info, files, and dependencies.module – function of the module optional files –.install,.inc,.tpl.php, etc. optional folders

Recipe for a Module Ingredients.info – module info, files, and dependencies.module – function of the module optional files –.inc,.tpl.php, etc. optional folders – css, images, etc.

Drupal Hooks PHP function Modifies Drupal behavior Similar to callback – Like triggered events Hook similar to object- oriented – Strict naming convention

Some Drupal Hooks hook_menu hook_block hook_footer hook_schema hook_help hook_permission hook_form Hook Information:

Hello World!

Test1.info

Test1.module

hook_menu() function test1_menu() { $items = array(); $items['test1'] = array( 'title' => 'PSU Creamery ice cream', 'description' => ’Select your favorite ice cream’, ‘page callback’ => ‘test1_page’, ‘access callback’ => TRUE, ‘type’ => MENU_CALLBACK, ); return $items; }

Test1.module (continue)

Test2.module

hook_help() function test2_help($path, $arg) { switch ($path) { case 'admin/help#test2':{ $ret_val = ' '. t('About'). ' '; $ret_val = ' '. t('This module will show detailed information of a specific ice cream.'). ' '; return $ret_val; break; }

hook_permission function test2_permission() { return array( 'administer test2' => array( 'title' => t('Administer test2'), 'description' => t('Perform administrative tasks on test2 functionality'), ), ); }

Configuration

Test3.info

Test3.module PSU Drupal Camp 2013 // Admin configuration group. $items['admin/config/drupalcamp'] = array( 'title' => 'drupalcamp', 'description' => 'Administer drupalcamp', 'access arguments' => array('administer drupalcamp'), ); // Admin configuration - Settings. $items['admin/config/drupalcamp/test3/manage'] = array( 'title' => 'test3', 'description' => 'Manage test3 settings and configurations.', 'access arguments' => array('administer test3'), 'page callback' => 'drupal_get_form', 'page arguments’=> array('test3_admin_settings_form'), );

hook_form() function test3_admin_settings_form($node, &$form_state) { $form = array(); $form['overview'] = array( '#markup' => t('This interface allows administrators to manage general test3 Settings'), '#prefix' => ' ', '#suffix' => ' ’,); $form['test3_maxnum'] = array( '#title' => t('Max number of cones per customer'), '#type' => 'textfield', '#default_value' => '2', '#required' => TRUE,); $form['submit'] = array( '#type' => 'submit', '#value' => t('Save'),); return $form; }

Validation

Test4.module PSU Drupal Camp 2013

hook_validate() function test4_admin_settings_form_validate($form, &$form_state) { // Regular expression for validating input number. $maxnum_regex = '/^[+-]?\d+$/'; // Shorthand for long array names. $input_num = $form_state['values']['maxnum']; // Validate maxnum format. if (!preg_match($maxnum_regex, $input_num)) { form_set_error('maxnum', t('Invalid number. Must be an integer.')); } // Validate maxnum value. if ($input_num <= 0) { form_set_error('maxnum', t('Must input a positive number.')); }}

validated test4 setting submission function test4_admin_settings_form_submit($form, &$form_state) { // Rebuild the form. $form_state['rebuild'] = TRUE; // Save test4 setting variables. variable_set('maxnum', $form_state['values']['maxnum']); // Notify user. drupal_set_message(t('test4 settings saved.'), 'status'); }

Enable the Module PSU Drupal Camp 2013

.install file runs when a module is enabled for the first time creates database tables and fields. instructions are included in a _install() function.

Test5.install

hook_install() PSU Drupal Camp 2013 function test5_install() { // Set default variables. variable_set('maxnum', 2); // Get localization function for installation as t() may be unavailable. $t = get_t(); // Give user feedback. drupal_set_message($t('test5 variables created.')); }

hook_uninstall() function test5_uninstall() { // Delete variables. variable_del('maxnum'); $t = get_t(); drupal_set_message($t('test5 variables removed.')); }

Test5.module PSU Drupal Camp 2013 Remove the validated submission variable_get('maxnum'), Return System_settings_form($form);

Thank you!