Hook, Drush, and Alters Oh Mai! Bryan Ollendyke.

Slides:



Advertisements
Similar presentations
PHP + Framework + MVC. What is Framework? Common code - Generic functionality Extensible - Specific functionality Unlike library – Flow Dictated by.
Advertisements

MIT Lincoln Laboratory A Service-Oriented Approach to Application Development Robert Darneille & Gary Schorer WPI MQP Presentations ICS Group 10 October.
Become a Panels Rockstar. Audience Survey Have you tried Panels? Are you a …. –Themer / Designer? –Developer / Code Junkie? –Information Architect?
Seattle Drupal Clinic Introduction to Drupal and Web Content Management.
Everything is (or should be planned as) a distribution! Bryan
Adding scalability to legacy PHP web applications Overview Mario A. Valdez-Ramirez.
Technical Architectures
Firefox 2 Feature Proposal: Remote User Profiles TeamOne August 3, 2007 TeamOne August 3, 2007.
High Performance Faceted Interfaces Using S2S Eric Rozell, Tetherless World Constellation.
James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
Kentico CMS 5.0 Full-featured Flexible Web Content Management System for All Your Needs.
Justin Klein Keane Drupal Training Session 1 Introduction to Drupal.
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.
Drupal and the CMS Project. Lesson Learned #1 Keep your modules updated, especially when there are security concerns in the update notes 2010 | The Sky’s.
Drupal 7 as an enterprise web application framework Why as a developer you should use Drupal to build web applications? Klaus Harris DrupalCon Munich 2012.
Service Oriented Architecture Bryan Ollendyke.
Presented by…. Group 2 1. Programming language 2Introduction.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
TOP 20 MISTAKES YOU WILL MAKE IN YOUR 1ST DRUPAL PROJECT IZTOK SMOLIČ, ZAGREB.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
SCHOOL OF INFORMATION UNIVERSITY OF MICHIGAN si.umich.edu Drupal: Configuration and Customization Week 4: Installation, Module Development January 25,
LAYING OUT THE FOUNDATIONS. OUTLINE Analyze the project from a technical point of view Analyze and choose the architecture for your application Decide.
Pittsburgh Java User Group– Dec Java PureFaces: A JSF Framework Extension.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
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.
C Copyright © 2009, Oracle. All rights reserved. Appendix C: Service-Oriented Architectures.
Bacon A Penetration and Auditing Framework Hernan Gips
Presentation: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
Feeds Module for Drupal 7 Use Cases, Overview, and Walktroughs.
CSCI 6962: Server-side Design and Programming Web Services.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Revolutionizing enterprise web development Searching with Solr.
© 2008 IBM Corporation ® IBM Cognos Business Viewpoint Miguel Garcia - Solutions Architect.
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.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Shakeh Elisabeth Khudikyan NASA Jet Propulsion Laboratory, California Institute of Technology A Look at Apache OODT Balance Framework.
What you don’t know you don’t know about Drupal 6 Dan Harris daneesia on drupal.org.
Forensic Drupal Debugging Dan Harris daneesia on drupal.org.
Seattle Drupal Clinic Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
NOVA Networked Object-based EnVironment for Analysis P. Nevski, A. Vaniachine, T. Wenaus NOVA is a project to develop distributed object oriented physics.
Drupal for NGOs 1 Amnesty.org redesign 22 July 2008.
Drush: The Drupal Shell Utility Trevor Mckeown Founder & Owner Sublime Technologies
Department of Computer Science Internet Performance Measurements using Firefox Extensions Scot L. DeDeo Professor Craig Wills.
CS 501: Software Engineering Fall 1999 Lecture 12 System Architecture III Distributed Objects.
Drupal Theming Chris Neglia and Lisa Forgan Copyright 2009, Page 1 Solutions.
Are You in the Right Room?  Want to learn about Features module  Are a beginner or intermediate drupaler who hasn't really used it yet  Don't have an.
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
MVC WITH CODEIGNITER Presented By Bhanu Priya.
System/SDWG Update Management Council Face-to-Face Flagstaff, AZ August 22-23, 2011 Sean Hardman.
DrupalCon 2011: Feedback ENTICE meeting 8 April 2011 Silvia Tomanin DG-CO.
DEV394.NET Framework: Migrating To Managed Code Adam Nathan QA Lead Richard Lander Program Manager Microsoft Corporation.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Thinking of Drupal 8? Get started with the resources.
Enterprise Library 3.0 Memi Lavi Solution Architect Microsoft Consulting Services Guy Burstein Senior Consultant Advantech – Microsoft Division.
Drupal Basics May 30, 2012 By Sean Fitzpatrick. Sean Fitzpatrick | Welcome We're going to talk about Drupal We're going to keep it pretty.
AVOIR -African virtual
Lecture 1: Multi-tier Architecture Overview
Using JDeveloper.
One Content Type to Rule Them All
Dive Deep Into Drupal Extension In Behat
Hans Zaunere, Managing Member
Plug-In Architecture Pattern
MS Confidential : SharePoint 2010 Developer Workshop (Beta1)
Presentation transcript:

Hook, Drush, and Alters Oh Mai! Bryan Ollendyke

Topics This is a code deep dive “Hello World” 10am in 206 Modules and Dev must haves Cover basic hooks Cover more obscure but useful hooks Examples provided throughout via contrib

Places to look for help Stackoverflow Api.drupal.org Drupal.org issue queues Drush.org

Must Have projects devel (drush support) Easy to debug all aspects of drupal objects drush - Drupal via Command line Ex: cc all Clear cache on all sites in this multi-site coder (drush support) Feedback on code quality based on Drupal community conventions Provides security audits and suggestions libraries API for reusable, non-drupal lib integration

Nice to Have projects devel_themer Theme debugging / template sniffing query_coder Convert SQL to Drupal query language features (drush support) Bundle exportable configuration Maintain consistency / version control IA profiler_builder (drush support) Help converting a site into a distribution Consistency across build routines (ulmus)

Nice to Have projects registry_rebuild (drush) Drush extension, life saver at times backup_migrate (drush support) UI / Drush based migrations module_builder (drush support) Generate module skeletons quickly examples Community approved example implementations of APIs

Other good API projects entity field_collection replicate Libraries context rules

Hook/alter architecture Commonly referred to as “the drupal way” Easy to override some else’s code Goal is to never modify others code unless absolutely necessary Common to write a “sitename_helper” style module loaded with alters

A few random Hooks init page_build page_alter form_alter menu menu_alter admin_paths theme_registry_alter custom_theme views_query_alter

Hook Example page_build page_alter

Alter Example page_build page_alter

Useful API functions arg($id) – part of the url (node/67/edit) arg(0) == ‘node’ arg(1) == 67 arg(2) == ‘edit’ arg(3) NULL menu_get_item – pull object from URL $node = menu_get_item(); the same as node_load(arg(1)); but more flexible (works with other menu objects)

Useful API functions module_load_include(‘module’, ‘yourproject’) Load an include file w.o. knowing path module_invokes(‘cron’); List all modules invoking a hook drupal_static($value, ‘default’); Centralized static caching drupal_form_submit(‘name’, $values) Programmatically trigger form to submit dvm($node) or dpm($node) Required devel, clean var_dump of object

Build own hooks module_invoke_all (‘things_stuff’) Assemble an array of all returns {MODULENAME}_things_stuff drupal_alter(‘things_stuff’, $data) $data passed by reference to all modules {MODULE}_things_stuff_alter(&$data); Invoking existing hook (like page_build) Call your module_invoke_all(‘myhook’); Follow it by drupal_alter(‘myhook’, $data); This allows other devs to safely mod

Common Site Example mooc_helper Supplamental glue code for install profile Mostly just injects minor changes Drupal.org/project/mooc Then view repository

Simple Library Example quojs Helps include quojs with Drupal Allows you to invoke js library from other modules Requires libraries API module drupal.org/project/quojs

Complex Example regions Stand alone “block” areas across-theme Creates its own API that is invoked Add “widgets” that function across themes Reuse components across sites easier Export via features cleaner w.o. theme issues drupal.org/project/regions

Complex Example cis_connector Web service endpoint for my edtech distros Caches http calls through a wrapper Uses mix of drupal_static and cache_set drupal.org/project/cis_connector

Complex Example entity_iframe Stand alone functionality for any site Themeable via tpl.php files Views integration Dynamic url rewriting per request Allows secure cross-frame communication drupal.org/project/entity_iframe

Simple Drush example drush dl outline_designer views regions cis_connector Download outline_designer, views, regions, and cis_connector to sites/all/modules --y can be used to answer yes to everything cc all Clear the cache on all sites

Writing your own Drush book_copy Replicate book outlines in Drupal Drush support for passing a node id drupal.org/project/book_copy

Maximize reuse See if functionality could be useful elsewhere Solve for Drupal, not for PSU hooks/alters to solution, PSU being just 1 Code “The drupal way” Try to structure code as follows: Contrib module – given away PSU – specific to university College – specific to our usage Implementation – specific to 1 deployment

Questions?