SlideShare a Scribd company logo
GETTING STARTED WITH 
DRUPALGAP 
Schedrov Alexander - sanchiz
SCHEDROV ALEXANDER 
AKA 
SANCHIZ 
Lead Drupal Developer at Trellon 
Maintainer: 
• pathauto_i18n 
• user_profile_comment 
• DrupalGapManager 
https://github.com/Sanchiz/DrupalGapManager 
Participant: 
• crm_core 
• relation_lists
MOBILE WEBSITE TRAFFIC 
Percentage of website traffic from mobile devices 
32 
24 
16 
8 
0 
30.0% 32.0% 29.0% 28.0% 
23.9% 
Q1 2013 Q2 2013 Q3 2013 Q4 2013 Q1 2014
MEET DRUPALGAP 
• Created by Tyler Frankenstein 
• First release Feb 25, 2012 ~100 lines 
• Currently ~10,000 lines
DRUPALGAP 
Drupal module 
hosted on d.org 
It's connection 
between mobile 
applications and 
Drupal websites via 
web Services. 
Development Kit hosted 
on GitHub 
Developers can create 
custom multi-platform 
mobile applications that 
communicate with their 
Drupal websites.
REGULAR SITE 
Website 
+ 
Responsive 
Website
WHY DO YOU NEED MOBILE 
APPLICATION? 
Our mobile phone have features which don't 
have our regular devices! 
! 
DrupalGap features: 
You don't need a Objective-C and Java developers. 
If you know how to build Drupal modules and 
know JavaScript - Welcome to DrupalGap 
developers.
Getting Started with DrupalGap
HOW IT WORKS? 
PhoneGap generates HTML, CSS 
and JavaScript and make application 
iOS and Android mobile 
devices. 
Apache Cordova provides access 
via JavaScript to device 
features such as the 
Camera, GPS, File System, 
Contacts, Compass, etc.
REQUIREMENTS 
DRUPAL 
Services, Rest_server, Views_datasource, Views_json, Drupalgap 
! 
DEVELOPMENT ENVIRONMENTS 
Google Chrome and the Ripple Emulator extension 
OR 
node.js 
cordova(node.js package) 
Java SDK for Android or xCode for iOS
DRUPALGAP INHERITS DRUPAL 
DEVELOPER CONCEPTS 
• Themes, modules 
• Blocks 
• Menus 
• Pages 
• Entities 
• Fields 
• Forms 
• Views 
• Messages 
• Services 
• Other Drupal 
tools
2 FOR DEALS 
https://play.google.com/store/apps/details?id=com.twofordeals
BETTRACKS 
https://bettracks.co.uk
EXTENSIBLE WITH CONTRIB MODULES 
• Force Authentication 
• Telephone 
• Address Field 
• AmazonS3 
• AudioField 
• Colorbox 
• Commerce 
• Commerce DrupalGap Stripe 
• Date 
• Email Registration 
• Entity reference 
• Fivestar 
• Flag 
• Geofield 
• GeoTracker 
• Link 
• Location 
• LoginToboggan 
• Pathfix 
• Push Notifications 
• Rate 
• Services Menu 
• Shadowbox 
• User registration password 
• Voting API 
• Webform 
http://www.drupalgap.org/project/modules
DRUPALGAP MANAGER 
is a command-line tool and interface for DrupalGap 
https://github.com/Sanchiz/DrupalGapManager 
https://www.npmjs.org/package/dgm
EVEN MORE…. INTEGRATION WITH COMMERCE 
http://tylerfrankenstein.com/code/build-mobile-app-sell-products-with-drupal
HOOKS IN 7.X-1.0-RC3 
*_404 
*_assemble_form_state_into_field 
*_block_info 
*_block_view 
*_deviceready 
*_drupalgap_goto_post_process 
*_drupalgap_goto_preprocess 
*_entity_post_render_content 
*_entity_post_render_field 
*_field_formatter_view 
*_field_widget_form 
*_form_alter 
*_image_path_alter 
*_install 
*_menu 
*_services_postprocess 
*_services_preprocess 
*_services_request_postprocess_alter 
*_services_request_pre_postprocess_alter 
*_services_success 
and custom forms 
http://api.drupalgap.org
FILE STRUCTURE 
modules 
themes 
settings.js
• core_app (module folder) 
• core_app.js (module file) 
/** 
* Implements hook_menu(). 
*/ 
function core_app_menu() { 
var items = {}; 
items['homepage'] = { 
title: 'New Sandbox', 
page_callback: 'core_app_homepage' 
}; 
return items; 
} 
! 
function core_app_homepage() { 
var content = {}; 
content['homepage'] = { 
markup: 'some markup' 
}; 
return content; 
settings.js: 
} 
Drupal.modules.custom['core_app'] = {};
OR CUSTOM BLOCK? 
/** 
* Implements hook_block_info(). 
*/ 
function core_app_block_info() { 
var blocks = { 
latest_news_block: { 
delta: 'latest_news_block', 
module: 'core_app' 
} 
}; 
return blocks; 
} 
! 
/** 
* Implements hook_block_view(). 
*/ 
function core_app_block_view(delta) { 
var content = ''; 
if (delta == 'latest_news_block') { 
content = '<h2>Latest news</h2>'; 
content += 'Some content...'; 
} 
return content; 
} 
drupalgap.settings.blocks.amazing = { 
content: { 
homepage_menu: { 
pages:{ 
value:['homepage'], 
mode:'include' 
} 
}, 
latest_news_block: { 
pages:{ 
value:['homepage'], 
mode:'exclude' 
} 
}, 
users_block: { 
pages:{ 
value:['node/*', 'user/*'], 
mode:'include' 
}, 
roles:{ 
value:['authenticated user'], 
mode:'include' 
} 
}, 
}, 
};
function core_app_voting_form(form, form_state) { 
form.elements.name = { 
OR CUSTOM FORM? type:'textfield', 
title:'Name', 
default_value: Drupal.user.name 
}; 
form.elements.email = { 
title:'Email Address', 
type:'email', 
required: true, 
default_value: Drupal.user.mail 
}; 
form.elements.categoty = { 
title:'Category', 
type:'select', 
options:{ 
0:'Feedback', 
1:'Question' 
}, 
default_value:0 
}; 
form.elements.comment = { 
title:'Comment', 
type:'textarea', 
}; 
form.elements.rating = { 
title:'Rating', 
type:'radios', 
required: true, 
options:{ 
0:'0', 
1:'+1', 
}, 
default_value:3 
}; 
form.elements.submit = { 
type:'submit', 
value:'Submit' 
}; 
return form; 
}
NEED ADDITIONAL FUNCTIONALITY? YOU GOT IT! 
1. Create custom services resource in Drupal module 
hook_services_resources(); 
2. Create custom services call in DrupalGap module 
Drupal.services.call(options); 
var output = ''; 
Drupal.services.call({ 
method: 'POST', 
path: 'news.json', 
data: args, 
success: function(result) { 
output = ''; 
$.each(result, function(i, node) { 
output += node.title; 
}); 
} 
});
VIEWS 
Need to create page with JSON data document 
format (views_json module) 
Displaying a View in mobile app 
function core_team_menu() { 
var items = {}; 
items['team'] = { 
title: 'Our team', 
page_callback: 'core_team_page' 
} 
return items; 
}
function core_team_page() { 
var content = {}; 
content['team'] = { 
theme: 'view', 
format: ‘ul', /* ul, ol, table, unformatted_list */ 
path: 'mobile/team_new', /* the path to the view in Drupal */ 
row_callback: 'core_team_page_row', 
empty_callback: 'core_team_page_empty', 
attributes: { 
id: 'team-view' 
} 
}; 
return content; 
} 
! 
function core_team_page_row(view, row) { 
var output = ''; 
output += '<img class="team-image" src="' + row.field_photo + '">'; 
output += l(row.title, 'node/' + row.Nid); 
return output; 
} 
! 
function core_team_page_empty(view) { 
return 'Sorry, no results.'; 
}
DEMO
THANK YOU! 
https://www.drupal.org/u/sanchiz 
https://github.com/Sanchiz 
http://sanchiz.net 
Email: alexander.schedrov@gmail.com 
Twitter: @alexschedrov

More Related Content

PDF
Building, Collaborating and Scaling Drupal Distributions for Federated Organi...
PDF
Build your application in seconds and optimize workflow as much as you can us...
PDF
DrupalGap. How to create native application for mobile devices based on Drupa...
PDF
OpenY: Scaling and Sharing with Custom Drupal Distribution
PDF
Drupal and diversity of Single sign-on systems
PPTX
Take your drupal sites offline
PDF
Drush - use full power - DrupalCamp Donetsk 2014
PDF
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
Building, Collaborating and Scaling Drupal Distributions for Federated Organi...
Build your application in seconds and optimize workflow as much as you can us...
DrupalGap. How to create native application for mobile devices based on Drupa...
OpenY: Scaling and Sharing with Custom Drupal Distribution
Drupal and diversity of Single sign-on systems
Take your drupal sites offline
Drush - use full power - DrupalCamp Donetsk 2014
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...

What's hot (20)

PDF
Docker, Ansible and Symfony micro-kernel
PDF
Don’t fight with windmills. Upgrade path tool from OpenY distro - Igor Karpil...
PDF
Introduction to VueJS & The WordPress REST API
PDF
WordPress 2017 with VueJS and GraphQL
PDF
Composer and deployer for enterprise
PDF
Building Mobile Applications with Ionic
PDF
Amsterdam.js talk: node webkit
PDF
10 New Things You Can Do with Drupal 8 Out-of-the-Box
ODP
Passo a Passo para criar uma aplicação Móvel Híbrida
PDF
Building a Single Page Application with VueJS
PDF
Best Practice Site Architecture in Drupal 8
PDF
Chrome enchanted 2015
PDF
The Heron Mapping Client
PDF
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
PDF
The Heron Mapping Client
PPTX
Untangling the web9
PDF
Making your Angular.js Application accessible
PPTX
JavaScript All The Things
PDF
Drupal Recipes: Building Image Galleries with jQuery and Flickr
PDF
[drupalday2017] - Speed-up your Drupal instance!
Docker, Ansible and Symfony micro-kernel
Don’t fight with windmills. Upgrade path tool from OpenY distro - Igor Karpil...
Introduction to VueJS & The WordPress REST API
WordPress 2017 with VueJS and GraphQL
Composer and deployer for enterprise
Building Mobile Applications with Ionic
Amsterdam.js talk: node webkit
10 New Things You Can Do with Drupal 8 Out-of-the-Box
Passo a Passo para criar uma aplicação Móvel Híbrida
Building a Single Page Application with VueJS
Best Practice Site Architecture in Drupal 8
Chrome enchanted 2015
The Heron Mapping Client
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
The Heron Mapping Client
Untangling the web9
Making your Angular.js Application accessible
JavaScript All The Things
Drupal Recipes: Building Image Galleries with jQuery and Flickr
[drupalday2017] - Speed-up your Drupal instance!
Ad

Viewers also liked (6)

PDF
Ansible is the simplest way to automate. MoldCamp, 2015
PDF
Ansible is the simplest way to automate. SymfonyCafe, 2015
PDF
Feeds. использование и создание плагинов. Feeds API
PPTX
Drupal Training Days 2017 - Drupal 8 basic functions.
PDF
Building mobile applications with DrupalGap
PDF
Scaling and sharing: Building custom drupal distributions for federated organ...
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015
Feeds. использование и создание плагинов. Feeds API
Drupal Training Days 2017 - Drupal 8 basic functions.
Building mobile applications with DrupalGap
Scaling and sharing: Building custom drupal distributions for federated organ...
Ad

Similar to Getting Started with DrupalGap (20)

PDF
DrupalGap. How to create native application for mobile devices based on Drupa...
PDF
Drupal Recipe
PDF
Drupal for Mobile
PDF
2007 Fsoss Drupal Under The Hood
PPTX
Drupal 7 Web Services Crash Course
KEY
For a Social Local and Mobile Drupal
PPT
Mobile Interface to CMS Based On HTML5 and Drupal: A Case Study
PDF
Introduction to drupal
PPTX
Drupal Overview For Techies
PPTX
Drupal Camp Porto - Developing with Drupal: First Steps
PDF
Drupal Is Not Your Web Site
PPTX
Drupal as a data server
PDF
Bringing Interactivity to Your Drupal Site with Node.js Integration
PDF
Drupal Flyover, CMS Expo
KEY
DrupalCon 2011 Highlight
PDF
Using VueJS in front of Drupal 8
PPTX
Why Enterprises Choose Drupal for Futuristic Web App Development?
PPT
DrupalCon Chicago 2011 ReportBack (11/03/30 - G. Bedford)
PDF
A deep dive into Drupal 8 routing
PDF
Showcasing drupal
DrupalGap. How to create native application for mobile devices based on Drupa...
Drupal Recipe
Drupal for Mobile
2007 Fsoss Drupal Under The Hood
Drupal 7 Web Services Crash Course
For a Social Local and Mobile Drupal
Mobile Interface to CMS Based On HTML5 and Drupal: A Case Study
Introduction to drupal
Drupal Overview For Techies
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Is Not Your Web Site
Drupal as a data server
Bringing Interactivity to Your Drupal Site with Node.js Integration
Drupal Flyover, CMS Expo
DrupalCon 2011 Highlight
Using VueJS in front of Drupal 8
Why Enterprises Choose Drupal for Futuristic Web App Development?
DrupalCon Chicago 2011 ReportBack (11/03/30 - G. Bedford)
A deep dive into Drupal 8 routing
Showcasing drupal

Recently uploaded (6)

DOC
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
PPTX
ASMS Telecommunication company Profile
DOC
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证
PDF
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
PDF
heheheueueyeyeyegehehehhehshMedia-Literacy.pdf
PDF
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
ASMS Telecommunication company Profile
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
heheheueueyeyeyegehehehhehshMedia-Literacy.pdf
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf

Getting Started with DrupalGap

  • 1. GETTING STARTED WITH DRUPALGAP Schedrov Alexander - sanchiz
  • 2. SCHEDROV ALEXANDER AKA SANCHIZ Lead Drupal Developer at Trellon Maintainer: • pathauto_i18n • user_profile_comment • DrupalGapManager https://github.com/Sanchiz/DrupalGapManager Participant: • crm_core • relation_lists
  • 3. MOBILE WEBSITE TRAFFIC Percentage of website traffic from mobile devices 32 24 16 8 0 30.0% 32.0% 29.0% 28.0% 23.9% Q1 2013 Q2 2013 Q3 2013 Q4 2013 Q1 2014
  • 4. MEET DRUPALGAP • Created by Tyler Frankenstein • First release Feb 25, 2012 ~100 lines • Currently ~10,000 lines
  • 5. DRUPALGAP Drupal module hosted on d.org It's connection between mobile applications and Drupal websites via web Services. Development Kit hosted on GitHub Developers can create custom multi-platform mobile applications that communicate with their Drupal websites.
  • 6. REGULAR SITE Website + Responsive Website
  • 7. WHY DO YOU NEED MOBILE APPLICATION? Our mobile phone have features which don't have our regular devices! ! DrupalGap features: You don't need a Objective-C and Java developers. If you know how to build Drupal modules and know JavaScript - Welcome to DrupalGap developers.
  • 9. HOW IT WORKS? PhoneGap generates HTML, CSS and JavaScript and make application iOS and Android mobile devices. Apache Cordova provides access via JavaScript to device features such as the Camera, GPS, File System, Contacts, Compass, etc.
  • 10. REQUIREMENTS DRUPAL Services, Rest_server, Views_datasource, Views_json, Drupalgap ! DEVELOPMENT ENVIRONMENTS Google Chrome and the Ripple Emulator extension OR node.js cordova(node.js package) Java SDK for Android or xCode for iOS
  • 11. DRUPALGAP INHERITS DRUPAL DEVELOPER CONCEPTS • Themes, modules • Blocks • Menus • Pages • Entities • Fields • Forms • Views • Messages • Services • Other Drupal tools
  • 12. 2 FOR DEALS https://play.google.com/store/apps/details?id=com.twofordeals
  • 14. EXTENSIBLE WITH CONTRIB MODULES • Force Authentication • Telephone • Address Field • AmazonS3 • AudioField • Colorbox • Commerce • Commerce DrupalGap Stripe • Date • Email Registration • Entity reference • Fivestar • Flag • Geofield • GeoTracker • Link • Location • LoginToboggan • Pathfix • Push Notifications • Rate • Services Menu • Shadowbox • User registration password • Voting API • Webform http://www.drupalgap.org/project/modules
  • 15. DRUPALGAP MANAGER is a command-line tool and interface for DrupalGap https://github.com/Sanchiz/DrupalGapManager https://www.npmjs.org/package/dgm
  • 16. EVEN MORE…. INTEGRATION WITH COMMERCE http://tylerfrankenstein.com/code/build-mobile-app-sell-products-with-drupal
  • 17. HOOKS IN 7.X-1.0-RC3 *_404 *_assemble_form_state_into_field *_block_info *_block_view *_deviceready *_drupalgap_goto_post_process *_drupalgap_goto_preprocess *_entity_post_render_content *_entity_post_render_field *_field_formatter_view *_field_widget_form *_form_alter *_image_path_alter *_install *_menu *_services_postprocess *_services_preprocess *_services_request_postprocess_alter *_services_request_pre_postprocess_alter *_services_success and custom forms http://api.drupalgap.org
  • 18. FILE STRUCTURE modules themes settings.js
  • 19. • core_app (module folder) • core_app.js (module file) /** * Implements hook_menu(). */ function core_app_menu() { var items = {}; items['homepage'] = { title: 'New Sandbox', page_callback: 'core_app_homepage' }; return items; } ! function core_app_homepage() { var content = {}; content['homepage'] = { markup: 'some markup' }; return content; settings.js: } Drupal.modules.custom['core_app'] = {};
  • 20. OR CUSTOM BLOCK? /** * Implements hook_block_info(). */ function core_app_block_info() { var blocks = { latest_news_block: { delta: 'latest_news_block', module: 'core_app' } }; return blocks; } ! /** * Implements hook_block_view(). */ function core_app_block_view(delta) { var content = ''; if (delta == 'latest_news_block') { content = '<h2>Latest news</h2>'; content += 'Some content...'; } return content; } drupalgap.settings.blocks.amazing = { content: { homepage_menu: { pages:{ value:['homepage'], mode:'include' } }, latest_news_block: { pages:{ value:['homepage'], mode:'exclude' } }, users_block: { pages:{ value:['node/*', 'user/*'], mode:'include' }, roles:{ value:['authenticated user'], mode:'include' } }, }, };
  • 21. function core_app_voting_form(form, form_state) { form.elements.name = { OR CUSTOM FORM? type:'textfield', title:'Name', default_value: Drupal.user.name }; form.elements.email = { title:'Email Address', type:'email', required: true, default_value: Drupal.user.mail }; form.elements.categoty = { title:'Category', type:'select', options:{ 0:'Feedback', 1:'Question' }, default_value:0 }; form.elements.comment = { title:'Comment', type:'textarea', }; form.elements.rating = { title:'Rating', type:'radios', required: true, options:{ 0:'0', 1:'+1', }, default_value:3 }; form.elements.submit = { type:'submit', value:'Submit' }; return form; }
  • 22. NEED ADDITIONAL FUNCTIONALITY? YOU GOT IT! 1. Create custom services resource in Drupal module hook_services_resources(); 2. Create custom services call in DrupalGap module Drupal.services.call(options); var output = ''; Drupal.services.call({ method: 'POST', path: 'news.json', data: args, success: function(result) { output = ''; $.each(result, function(i, node) { output += node.title; }); } });
  • 23. VIEWS Need to create page with JSON data document format (views_json module) Displaying a View in mobile app function core_team_menu() { var items = {}; items['team'] = { title: 'Our team', page_callback: 'core_team_page' } return items; }
  • 24. function core_team_page() { var content = {}; content['team'] = { theme: 'view', format: ‘ul', /* ul, ol, table, unformatted_list */ path: 'mobile/team_new', /* the path to the view in Drupal */ row_callback: 'core_team_page_row', empty_callback: 'core_team_page_empty', attributes: { id: 'team-view' } }; return content; } ! function core_team_page_row(view, row) { var output = ''; output += '<img class="team-image" src="' + row.field_photo + '">'; output += l(row.title, 'node/' + row.Nid); return output; } ! function core_team_page_empty(view) { return 'Sorry, no results.'; }
  • 25. DEMO
  • 26. THANK YOU! https://www.drupal.org/u/sanchiz https://github.com/Sanchiz http://sanchiz.net Email: [email protected] Twitter: @alexschedrov