SlideShare a Scribd company logo
CKEditor Widgets with Drupal
Engr. Ranel O. Padon	

	

Kite Systems | http://github.com/ranelpadon
About Me
•  Software Engineer at Kite Systems (Hong Kong-based company)	

–  full-time Drupal developer for CNN Travel (our client)	

•  part-time Python lecturer in University of the Philippines	

•  involved in Java and Python projects before	

•  plays competitive futsal
Topics
•  Why give importance on contents?	

•  Why use a WYSIWYG tool and CKEditor?	

•  Why use widgets?	

•  How to create widget from scratch?	

–  Grouped Texts widget	

–  HERE Maps widget	

•  CNN Travel in-house widgets 	

–  Inline Ads 	

–  Inline Maps	

–  Service Info widget	

•  My personal project: Leaflet Maps widget
Why Contents?
•  one of the best ways to drive traffic to your site
is to create valuable and interesting contents	

•  to create high-quality contents the editors must
have effective and high-quality tools
Why WYSIWYG?
•  WYSIWYG (WhatYou See Is WhatYou Get)
Editors could be used to create/edit contents
directly in your web site	

•  eliminates the need to use a word document
processor(MS Word, LibreOffice Writer)	

•  boosts editor’s productivity
Why WYSIWYG?
•  Node view	

(normal page view)
Why WYSIWYG?
•  Node Edit link
CKEditor Toolbar	

•  Node Edit view	

(CKEditor view)
Why CKEditor?
image captured from http://www.ckeditor.com
Why CKEditor?
image captured from http://www.ckeditor.com
Why CKEditor?
image captured from http://www.ckeditor.com
Why CKEditor?
image captured from http://www.ckeditor.com
Why CKEditor?
image captured from http://www.ckeditor.com
Why CKEditor?
•  Has good support for common CMSes like
Drupal, WordPress, Django, etc.	

•  Default WYSIWYG Editor in Drupal 8!
Why CKEditor?
•  Check-out xEditor 2.0 for in-place editing
of contents (Drupal module for live node
view editing):
https://www.drupal.org/project/xeditor
Why CKEditor?
•  a redesigned version of FCKeditor	

•  created by Frederico Caldeira Knabben
Why Widgets?
•  grouped CKEditor elements	

•  subclass of the Plugin class	

•  widget styling has a template	

	

- could have a generic style for all widget 	

	

- could have specific style for specific via a 	

 	

	

 custom Dialog window	

•  widget is a drag-and-drop element, but as a group	

•  widgets could have multiple instances
Why Widgets?
	

•  we use to inject spatial information in our
content using a customized Drupal’s Leaflet
module.	

•  we could display maps in Leaflet as a block
but it could be too limiting	

•  sometimes our editors write articles like
Top10 articles in Hong Kong and want to
insert the map alongside its content writeup
Widget 1: Grouped Texts
Widget 2: Code Snippets
Widget 3: Annotated Images
Widget 4: Math Formulas
CKEditor Widgets Live Demo
•  Check-out the live demo of the four widgets:	

	

http://ckeditor.com/demo#widgets
Custom Widget
•  Structure/Required Files	

–  PLUGIN_NAME/plugin.js	

–  PLUGIN_NAMEs/css/contents.css	

–  PLUGIN_NAME/icons/PLUGIN_NAME.png
Custom Widget: Grouped texts
•  Required Files	

–  grouped_texts/plugin.js	

–  grouped_texts/css/contents.css	

–  grouped_texts/icons/grouped_texts.png	

ideas for this sample widget is obtained from the Simple Box widget from here:	

	

 https://github.com/ckeditor/ckeditor-docs/tree/master/guides/widget_sdk/tutorial_1
Custom Widget: Grouped texts
Custom Widget: Grouped texts
Custom Widget: Grouped texts
–  grouped_texts/plugin.js
Custom Widget: Grouped texts
Custom Widget: Grouped texts
Custom Widget: Grouped texts
Custom Widget: Grouped texts
–  grouped_texts/css/contents.css
Custom Widget: HERE Maps
Workhorse Widget Files	

•  Plugin Core: Defines the plugin and attaches the
plugin to the CKEditor toolbar.	

•  Dialog Script: Displays the map options when
creating and editing existing maps.	

•  Map Iframe Renderer: Parses the map options via
URL and renders the map accordingly.
Custom Widget: HERE Maps
•  Widget Files	

–  here_maps/plugin.js	

–  here_maps/css/contents.css	

–  here_maps/icons/here_maps.png	

–  here_maps/dialogs/here_maps.js	

–  here_maps/scripts/here_maps_iframe.html
Custom Widget: HERE Maps
•  Creating a new HERE Maps widget
Custom Widget: HERE Maps
•  Inserting the new HERE Maps widget; loads the iframe element
Custom Widget: HERE Maps
•  Editing the HERE Maps widget (by double-clicking the handle bars that
displays in upper-left corner of the widget when you hover the mouse)
Custom Widget: HERE Maps
–  here_maps/plugin.js
Custom Widget: HERE Maps
–  here_maps/plugin.js
Custom Widget: HERE Maps
–  here_maps/dialog/here_maps.js
Custom Widget: HERE Maps
–  here_maps/dialog/here_maps.js (setup method, for editing
existing widgets)
Custom Widget: HERE Maps
–  here_maps/dialog/here_maps.js (setup and commit methods)
Custom Widget: HERE Maps
–  here_maps/dialog/here_maps.js (commit method, acts as a Submit/
Save handler)
Custom Widget: HERE Maps
–  here_maps/dialog/here_maps.js (commit method)
Custom Widget: HERE Maps
–  here_maps/scripts/here_maps_iframe.html (executes when the commit
method is called)
Custom Widget: HERE Maps
–  parse the URL 	

query parameters	

and pass them as info	

to build the map
Custom Widget: HERE Maps
–  build the map 	

using the info 	

from iframe’s URL
Custom Widget: HERE Maps
–  specify the HERE Maps credentials, could be passed as URL params
also or store them in Drupal.settings object
Custom Widget: HERE Maps
–  instantiate a new map using the specified map options via URL
(Latitude and Longitude parameters)	

–  you could include via URL other map variables like zoom level, map
center, etc
Custom Widget: Drupal Hook
the custom widgets could be registered in Drupal using
hook_ckeditor_plugins:	
  
Custom Widget: Drupal Hook
Custom Widget: Drupal Hook
Custom Widget: Drupal Hook
enable them in the activated CKEditor profile,	

usually in admin/config/content/ckeditor/edit/Advanced 	
  
Custom Widget: Drupal Hook
they must be included in the Current Toolbar as well	
  
Custom Widget: Drupal Hook
they will now appear in the CKEditor toolbar when adding/editing
articles/contents	
  
CNN Travel Ads Widget
has similar mechanism to that of HERE Maps widget (uses iframe also)	
  
CNN Travel Ads Widget
Dialog window’s options 	

for specifying ads	
  
CNN Travel Map Widget
•  maps could show one or more places	

•  maps could have various dimensions	

•  maps could have the specified alignment	

•  could show nearby TripAdvisor places	

•  popups should be styled similar to
TripAdvisor	

•  preserves the last zoom level state	

–  via mouse scroll zoom events
CNN Travel Map Widget
•  Node Edit mode
CNN Travel Map Widget
•  Node Edit mode	

•  shows the Dialog window’s Places tab options
CNN Travel Map Widget
•  Node Edit mode	

•  shows the Options tab and the auto-
complete search functionality	

•  uses Twitter’s TypeAhead API and 	

fetches live data from TripAdvisor’s servers
CNN Travel Service Info
•  CNN Travel Map widget plus other add-ons	

•  shows one Place only	

•  focuses on custom texts and TripAdvisor data	

–  user ratings/reviews	

–  booking info
CNN Travel Service Info
•  Node Edit mode (Hong Kong’s Insider Guide article)	

	

http://travel.cnn.com/destinations-insider-guide-hong-kong-954446	

http://travel.cnn.com/destinations-insider-guide-hong-kong-954446
CNN Travel Service Info
•  Node Edit mode
CNN Travel Service Info
http://travel.cnn.com/destinations-insider-guide-hong-kong-954446
CNN Travel Service Info
http://travel.cnn.com/destinations-insider-guide-hong-kong-954446	

•  the widget
showing the
TripAdvisor
reviews
CNN Travel Service Info
http://travel.cnn.com/destinations-insider-guide-hong-kong-954446	

•  the widget
showing the
HERE Maps
section
Challenges We Encountered
•  iframes are notoriosly slow, for contents with
lot of map widgets, the page takes too long to
fully load	

•  we refactored our widget implementation
and converted the map iframes to ordinary
divs, and treated the main page as the main
iframe for all the widgets
Challenges We Encountered
•  we further optimized the widget rendering by
rendering them only as needed or as the page
scrolls	

•  so if the widget is not currently visible in the
viewing area, the widget will be not rendered
yet
CKEditor leaflet Maps
Project Page: http://ckeditor.com/addon/leaflet
CKEditor leaflet Maps
Live Demo: 	

http://ranelpadon.github.io/ckeditor-leaflet/index.html
CKEditor leaflet Maps
Live Demo (Dialog window): 	

http://ranelpadon.github.io/ckeditor-leaflet/index.html
CKEditor leaflet Maps
Utilizes these libraries:	

	

•  CKEditor's Widget API	

•  Google's Places Library/Type-Ahead Search	

•  Google's Geocoding API	

•  Leaflet JS, 	

•  Leaflet - Tile Providers	

•  Leaflet - MiniMap
CKEditor leaflet Maps
•  has good code base (with ample inline code
comments) when you want to develop
custom widgets	

•  includes installation guide that could be useful
in installing CKEditor and/or plugins/widgets
in Drupal:
https://github.com/ranelpadon/ckeditor-leaflet/blob/
master/Installation%20Guide.txt
Recommendation
•  take time to read the much improved and
comprehensive documentation (includes
useful links to related resources) and
familiarize yourself to the valuable APIs:	

–  http://sdk.ckeditor.com
Recommendation | CKEditor sdk
Special Thanks
•  CNN Travel (http://travel.cnn.com) for
allowing me to share what we are working on.	

	

•  HERE (http://here.com) for sponsoring my talk.
What did you think about the presentation ?	

	

	

Leave your feedback and 	

help us improve Drupalcamp on :	

http://2014.drupalcebu.org/

More Related Content

PDF
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
PDF
Views Unlimited: Unleashing the Power of Drupal's Views Module
PDF
Power and Elegance - Leaflet + jQuery
PDF
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
POTX
Thoughts on Component Resuse
PDF
Accelerate Your Next AEM Project
PDF
12 hot features to engage and save time with aem 6.2
PPTX
Adobe AEM core components
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
Views Unlimited: Unleashing the Power of Drupal's Views Module
Power and Elegance - Leaflet + jQuery
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Thoughts on Component Resuse
Accelerate Your Next AEM Project
12 hot features to engage and save time with aem 6.2
Adobe AEM core components

What's hot (7)

PPT
Widget Tutorial
PPTX
Gephi Plugin Developer Workshop
ZIP
Adapter Design Pattern
PPT
The Larch - a visual interactive programming environment
PDF
The New Way of Developing with AEM 6.0 | Sightly | Beautiful Markup
PPTX
AEM and Sling
PDF
ML Infra for Netflix Recommendations - AI NEXTCon talk
Widget Tutorial
Gephi Plugin Developer Workshop
Adapter Design Pattern
The Larch - a visual interactive programming environment
The New Way of Developing with AEM 6.0 | Sightly | Beautiful Markup
AEM and Sling
ML Infra for Netflix Recommendations - AI NEXTCon talk
Ad

Viewers also liked (20)

KEY
Responsive web-design
PPTX
INCF 2013 - Uniform Resource Layer
ODP
LVEE 2014: Text parsing with Python and PLY
PDF
Text analysis using python
PDF
PyCon PH 2014 - GeoComputation
PDF
WAD : A Module for Converting Fatal Extension Errors into Python Exceptions
PDF
Generator Tricks for Systems Programmers
PDF
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
PDF
Understanding the Python GIL
PDF
Generator Tricks for Systems Programmers, v2.0
PDF
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
PDF
SWIG : An Easy to Use Tool for Integrating Scripting Languages with C and C++
PDF
Python introduction
PDF
Python Programming - X. Exception Handling and Assertions
PDF
Python for text processing
PDF
Python Programming - III. Controlling the Flow
PDF
Python Programming - VII. Customizing Classes and Operator Overloading
PDF
Python Programming - IX. On Randomness
PDF
Switchable Map APIs with Drupal
PDF
Python Programming - I. Introduction
Responsive web-design
INCF 2013 - Uniform Resource Layer
LVEE 2014: Text parsing with Python and PLY
Text analysis using python
PyCon PH 2014 - GeoComputation
WAD : A Module for Converting Fatal Extension Errors into Python Exceptions
Generator Tricks for Systems Programmers
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
Understanding the Python GIL
Generator Tricks for Systems Programmers, v2.0
Why Extension Programmers Should Stop Worrying About Parsing and Start Thinki...
SWIG : An Easy to Use Tool for Integrating Scripting Languages with C and C++
Python introduction
Python Programming - X. Exception Handling and Assertions
Python for text processing
Python Programming - III. Controlling the Flow
Python Programming - VII. Customizing Classes and Operator Overloading
Python Programming - IX. On Randomness
Switchable Map APIs with Drupal
Python Programming - I. Introduction
Ad

Similar to CKEditor Widgets with Drupal (20)

PPTX
Syncfusion Dashboard Platform SDK
PPTX
European Collaboration Summit - SharePoint Framework Angular & Azure Functions
PDF
Easily Create Maps in Drupal with Leaflet
PDF
Easily Create Maps in Drupal with Leaflet
PDF
Go for building cross-platform graphical apps
PPT
BlackBerry Basic
PDF
##dd12 sviluppo mobile XPages
PDF
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
PDF
Diving Into Xamarin.Forms
PDF
Contentful with Netgen Layouts workshop
PPTX
Deep dive into share point framework webparts
PDF
Microsoft Power Page for Developer - ภาษาไทย
PPTX
Visio services in sharepoint 2013
PPTX
Major project 2013 14
PPTX
Micro frontend
PPTX
Flex en silverlight viewer configuratie, Esri, Mark Jagt, Boudewijn Boogaard
PDF
CUST-2 New Client Configuration & Extension Points in Share
PPTX
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
PPTX
Angular or React
PDF
Migrating a large scale banking app to compose
Syncfusion Dashboard Platform SDK
European Collaboration Summit - SharePoint Framework Angular & Azure Functions
Easily Create Maps in Drupal with Leaflet
Easily Create Maps in Drupal with Leaflet
Go for building cross-platform graphical apps
BlackBerry Basic
##dd12 sviluppo mobile XPages
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Diving Into Xamarin.Forms
Contentful with Netgen Layouts workshop
Deep dive into share point framework webparts
Microsoft Power Page for Developer - ภาษาไทย
Visio services in sharepoint 2013
Major project 2013 14
Micro frontend
Flex en silverlight viewer configuratie, Esri, Mark Jagt, Boudewijn Boogaard
CUST-2 New Client Configuration & Extension Points in Share
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Angular or React
Migrating a large scale banking app to compose

More from Ranel Padon (10)

PDF
Python Programming - XIII. GUI Programming
PDF
Python Programming - XII. File Processing
PDF
Python Programming - XI. String Manipulation and Regular Expressions
PDF
Python Programming - VIII. Inheritance and Polymorphism
PDF
Python Programming - VI. Classes and Objects
PDF
Python Programming - V. Sequences (List and Tuples) and Dictionaries
PDF
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
PDF
Python Programming - II. The Basics
PDF
Of Nodes and Maps (Web Mapping with Drupal - Part II)
PDF
Web Mapping with Drupal
Python Programming - XIII. GUI Programming
Python Programming - XII. File Processing
Python Programming - XI. String Manipulation and Regular Expressions
Python Programming - VIII. Inheritance and Polymorphism
Python Programming - VI. Classes and Objects
Python Programming - V. Sequences (List and Tuples) and Dictionaries
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
Python Programming - II. The Basics
Of Nodes and Maps (Web Mapping with Drupal - Part II)
Web Mapping with Drupal

Recently uploaded (20)

PDF
Transforming Manufacturing operations through Intelligent Integrations
PPTX
CroxyProxy Instagram Access id login.pptx
PDF
REPORT: Heating appliances market in Poland 2024
PDF
CIFDAQ's Teaching Thursday: Moving Averages Made Simple
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
DevOps & Developer Experience Summer BBQ
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced IT Governance
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Omni-Path Integration Expertise Offered by Nor-Tech
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Event Presentation Google Cloud Next Extended 2025
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
Transforming Manufacturing operations through Intelligent Integrations
CroxyProxy Instagram Access id login.pptx
REPORT: Heating appliances market in Poland 2024
CIFDAQ's Teaching Thursday: Moving Averages Made Simple
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
DevOps & Developer Experience Summer BBQ
20250228 LYD VKU AI Blended-Learning.pptx
Advanced IT Governance
GamePlan Trading System Review: Professional Trader's Honest Take
Omni-Path Integration Expertise Offered by Nor-Tech
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Review of recent advances in non-invasive hemoglobin estimation
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Chapter 3 Spatial Domain Image Processing.pdf
Event Presentation Google Cloud Next Extended 2025
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Advanced Soft Computing BINUS July 2025.pdf
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf

CKEditor Widgets with Drupal

  • 1. CKEditor Widgets with Drupal Engr. Ranel O. Padon Kite Systems | http://github.com/ranelpadon
  • 2. About Me •  Software Engineer at Kite Systems (Hong Kong-based company) –  full-time Drupal developer for CNN Travel (our client) •  part-time Python lecturer in University of the Philippines •  involved in Java and Python projects before •  plays competitive futsal
  • 3. Topics •  Why give importance on contents? •  Why use a WYSIWYG tool and CKEditor? •  Why use widgets? •  How to create widget from scratch? –  Grouped Texts widget –  HERE Maps widget •  CNN Travel in-house widgets –  Inline Ads –  Inline Maps –  Service Info widget •  My personal project: Leaflet Maps widget
  • 4. Why Contents? •  one of the best ways to drive traffic to your site is to create valuable and interesting contents •  to create high-quality contents the editors must have effective and high-quality tools
  • 5. Why WYSIWYG? •  WYSIWYG (WhatYou See Is WhatYou Get) Editors could be used to create/edit contents directly in your web site •  eliminates the need to use a word document processor(MS Word, LibreOffice Writer) •  boosts editor’s productivity
  • 6. Why WYSIWYG? •  Node view (normal page view)
  • 8. CKEditor Toolbar •  Node Edit view (CKEditor view)
  • 9. Why CKEditor? image captured from http://www.ckeditor.com
  • 10. Why CKEditor? image captured from http://www.ckeditor.com
  • 11. Why CKEditor? image captured from http://www.ckeditor.com
  • 12. Why CKEditor? image captured from http://www.ckeditor.com
  • 13. Why CKEditor? image captured from http://www.ckeditor.com
  • 14. Why CKEditor? •  Has good support for common CMSes like Drupal, WordPress, Django, etc. •  Default WYSIWYG Editor in Drupal 8!
  • 15. Why CKEditor? •  Check-out xEditor 2.0 for in-place editing of contents (Drupal module for live node view editing): https://www.drupal.org/project/xeditor
  • 16. Why CKEditor? •  a redesigned version of FCKeditor •  created by Frederico Caldeira Knabben
  • 17. Why Widgets? •  grouped CKEditor elements •  subclass of the Plugin class •  widget styling has a template - could have a generic style for all widget - could have specific style for specific via a custom Dialog window •  widget is a drag-and-drop element, but as a group •  widgets could have multiple instances
  • 18. Why Widgets? •  we use to inject spatial information in our content using a customized Drupal’s Leaflet module. •  we could display maps in Leaflet as a block but it could be too limiting •  sometimes our editors write articles like Top10 articles in Hong Kong and want to insert the map alongside its content writeup
  • 20. Widget 2: Code Snippets
  • 22. Widget 4: Math Formulas
  • 23. CKEditor Widgets Live Demo •  Check-out the live demo of the four widgets: http://ckeditor.com/demo#widgets
  • 24. Custom Widget •  Structure/Required Files –  PLUGIN_NAME/plugin.js –  PLUGIN_NAMEs/css/contents.css –  PLUGIN_NAME/icons/PLUGIN_NAME.png
  • 25. Custom Widget: Grouped texts •  Required Files –  grouped_texts/plugin.js –  grouped_texts/css/contents.css –  grouped_texts/icons/grouped_texts.png ideas for this sample widget is obtained from the Simple Box widget from here: https://github.com/ckeditor/ckeditor-docs/tree/master/guides/widget_sdk/tutorial_1
  • 28. Custom Widget: Grouped texts –  grouped_texts/plugin.js
  • 32. Custom Widget: Grouped texts –  grouped_texts/css/contents.css
  • 33. Custom Widget: HERE Maps Workhorse Widget Files •  Plugin Core: Defines the plugin and attaches the plugin to the CKEditor toolbar. •  Dialog Script: Displays the map options when creating and editing existing maps. •  Map Iframe Renderer: Parses the map options via URL and renders the map accordingly.
  • 34. Custom Widget: HERE Maps •  Widget Files –  here_maps/plugin.js –  here_maps/css/contents.css –  here_maps/icons/here_maps.png –  here_maps/dialogs/here_maps.js –  here_maps/scripts/here_maps_iframe.html
  • 35. Custom Widget: HERE Maps •  Creating a new HERE Maps widget
  • 36. Custom Widget: HERE Maps •  Inserting the new HERE Maps widget; loads the iframe element
  • 37. Custom Widget: HERE Maps •  Editing the HERE Maps widget (by double-clicking the handle bars that displays in upper-left corner of the widget when you hover the mouse)
  • 38. Custom Widget: HERE Maps –  here_maps/plugin.js
  • 39. Custom Widget: HERE Maps –  here_maps/plugin.js
  • 40. Custom Widget: HERE Maps –  here_maps/dialog/here_maps.js
  • 41. Custom Widget: HERE Maps –  here_maps/dialog/here_maps.js (setup method, for editing existing widgets)
  • 42. Custom Widget: HERE Maps –  here_maps/dialog/here_maps.js (setup and commit methods)
  • 43. Custom Widget: HERE Maps –  here_maps/dialog/here_maps.js (commit method, acts as a Submit/ Save handler)
  • 44. Custom Widget: HERE Maps –  here_maps/dialog/here_maps.js (commit method)
  • 45. Custom Widget: HERE Maps –  here_maps/scripts/here_maps_iframe.html (executes when the commit method is called)
  • 46. Custom Widget: HERE Maps –  parse the URL query parameters and pass them as info to build the map
  • 47. Custom Widget: HERE Maps –  build the map using the info from iframe’s URL
  • 48. Custom Widget: HERE Maps –  specify the HERE Maps credentials, could be passed as URL params also or store them in Drupal.settings object
  • 49. Custom Widget: HERE Maps –  instantiate a new map using the specified map options via URL (Latitude and Longitude parameters) –  you could include via URL other map variables like zoom level, map center, etc
  • 50. Custom Widget: Drupal Hook the custom widgets could be registered in Drupal using hook_ckeditor_plugins:  
  • 53. Custom Widget: Drupal Hook enable them in the activated CKEditor profile, usually in admin/config/content/ckeditor/edit/Advanced  
  • 54. Custom Widget: Drupal Hook they must be included in the Current Toolbar as well  
  • 55. Custom Widget: Drupal Hook they will now appear in the CKEditor toolbar when adding/editing articles/contents  
  • 56. CNN Travel Ads Widget has similar mechanism to that of HERE Maps widget (uses iframe also)  
  • 57. CNN Travel Ads Widget Dialog window’s options for specifying ads  
  • 58. CNN Travel Map Widget •  maps could show one or more places •  maps could have various dimensions •  maps could have the specified alignment •  could show nearby TripAdvisor places •  popups should be styled similar to TripAdvisor •  preserves the last zoom level state –  via mouse scroll zoom events
  • 59. CNN Travel Map Widget •  Node Edit mode
  • 60. CNN Travel Map Widget •  Node Edit mode •  shows the Dialog window’s Places tab options
  • 61. CNN Travel Map Widget •  Node Edit mode •  shows the Options tab and the auto- complete search functionality •  uses Twitter’s TypeAhead API and fetches live data from TripAdvisor’s servers
  • 62. CNN Travel Service Info •  CNN Travel Map widget plus other add-ons •  shows one Place only •  focuses on custom texts and TripAdvisor data –  user ratings/reviews –  booking info
  • 63. CNN Travel Service Info •  Node Edit mode (Hong Kong’s Insider Guide article) http://travel.cnn.com/destinations-insider-guide-hong-kong-954446 http://travel.cnn.com/destinations-insider-guide-hong-kong-954446
  • 64. CNN Travel Service Info •  Node Edit mode
  • 65. CNN Travel Service Info http://travel.cnn.com/destinations-insider-guide-hong-kong-954446
  • 66. CNN Travel Service Info http://travel.cnn.com/destinations-insider-guide-hong-kong-954446 •  the widget showing the TripAdvisor reviews
  • 67. CNN Travel Service Info http://travel.cnn.com/destinations-insider-guide-hong-kong-954446 •  the widget showing the HERE Maps section
  • 68. Challenges We Encountered •  iframes are notoriosly slow, for contents with lot of map widgets, the page takes too long to fully load •  we refactored our widget implementation and converted the map iframes to ordinary divs, and treated the main page as the main iframe for all the widgets
  • 69. Challenges We Encountered •  we further optimized the widget rendering by rendering them only as needed or as the page scrolls •  so if the widget is not currently visible in the viewing area, the widget will be not rendered yet
  • 70. CKEditor leaflet Maps Project Page: http://ckeditor.com/addon/leaflet
  • 71. CKEditor leaflet Maps Live Demo: http://ranelpadon.github.io/ckeditor-leaflet/index.html
  • 72. CKEditor leaflet Maps Live Demo (Dialog window): http://ranelpadon.github.io/ckeditor-leaflet/index.html
  • 73. CKEditor leaflet Maps Utilizes these libraries: •  CKEditor's Widget API •  Google's Places Library/Type-Ahead Search •  Google's Geocoding API •  Leaflet JS, •  Leaflet - Tile Providers •  Leaflet - MiniMap
  • 74. CKEditor leaflet Maps •  has good code base (with ample inline code comments) when you want to develop custom widgets •  includes installation guide that could be useful in installing CKEditor and/or plugins/widgets in Drupal: https://github.com/ranelpadon/ckeditor-leaflet/blob/ master/Installation%20Guide.txt
  • 75. Recommendation •  take time to read the much improved and comprehensive documentation (includes useful links to related resources) and familiarize yourself to the valuable APIs: –  http://sdk.ckeditor.com
  • 77. Special Thanks •  CNN Travel (http://travel.cnn.com) for allowing me to share what we are working on. •  HERE (http://here.com) for sponsoring my talk.
  • 78. What did you think about the presentation ? Leave your feedback and help us improve Drupalcamp on : http://2014.drupalcebu.org/