Why entity forms?


Published on

Italo Mairo @ Drupal Days 2014

Published in: Internet, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Why entity forms?

  1. 1. Milano - 8 Maggio @ 2014 - italomairo.com WHY ENTITY FORMS? The Case Study
 Management & Subscription of Editorial Plans 
 in the Fiera Milano Media Drupal WebSite
 www.fieramilanomedia.it ! curated by Italo Mairo
  2. 2. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com Why Entityforms? Every skilled Drupalis knows Webforms. 
 They have been widely used in the new institutional website of Fiera Milano Media. But the Entityform Module/Approach has been the most effective for the implementation of sophisticated Management (by Internal users) & Subscription (by External users) system of Editorial Plans & Contents. We will describe the logical approach and design, the structure of Ajax EntityForms able to dynamically expose Editorial Content (frontend) and the functional logic of subscriptions interfaces (Views) and their contents’ management (backend).
  3. 3. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com Entityform module (http://drupal.org/project/entityform) As its creator, Ted Bowman, further explained on Thu 10/25/2012 in the following article: http://www.sixmiletech.com/content/why-entityforms-case-field-and-entity-based-survey-system-drupal • Entityforms (differently from Webforms) are entities and use standard Drupal fields. • Entityform submissions themselves are field-able entities. This has many advantages including being able to use virtually any field module in Drupal. Now we can easily gather geographic information, reference site content and include media references in your surveys and other forms. • It also allows for simple integration with popular entity-aware modules.
 With Entityforms thanks to the Entity API module, Rules and Views have complete knowledge of the submission information just as they do with the field values attached to other entities such as Nodes and Users. With Webform, while possible, the same process is not as simple. • Also for programmers the process of interacting with Entityforms is much more familiar..  You can also use great helper classes such as the EntityFieldQuery and Entity Metadata Wrappers to make dealing with these entities much easier.
  4. 4. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com Fiera Milano Media - www.fieramilanomedia.it Fiera Milano Media is the Fiera Milano group company specializing in the specialized press, in B2B communication, management training and digital services. Revenue breakdown Balance Sheet 2013 34%$ 23%$ 23%$ 20%$ PUBLISHING$ EDUCATION$ OUTDOOR$&$VENUE$ DIGITAL$ • 13 trade magazines • 9 web portals • 55 events / trade shows • 120 training courses ! • 2 B2B databases with more than 700 thousand profiled users • 2 outdoor venues*
  5. 5. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com Fiera Milano Media website (www.fieramilanomedia.it) has been developed (by me, on behalf of Crismaitalia srl) with Drupal 7 (since 2012) let’s link in its bank-end (local link) ->
  6. 6. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com Webforms Data Collection in Fiera Milano Media Webforms have been extensively used in the Fiera Milano Media web site to collect different kinds of users subscriptions:
 http://fieramilanomedianew/it/admin/ elenco_webforms
 • Newsletter Subscription • Free copy request • Digital Magazine Subscription • etc
  7. 7. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com Each year, in advance, magazines’ editors and the company as a whole define the so-called “editorial plans”: annual programming, month by month numbers of different magazines and the main issues to be treated within them. The Editorial Plan of each Magazine is defined through: Magazine Number / Month > Editorial Contents (1 - n) This schedule is released outwards, so that an external user (typically the company/press agency) may subscribe showing its interest in contributing at editorial level. Magazine Number / Month Year Editorial Contents (1 - n) 1 n Fiera Milano Media Editorial Plans Subscriptions
  8. 8. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com Fiera Milano Media Editorial Plans Subscriptions Previous subscription method (and traditional), very complex: External user: • download pdf > print and fill > send back via email (and scan) or via fax Fiera Milano Media Operator/Editor: • Manual drafting of editorial plans, in pdf format • Acquisition via fax/email of requests/subscriptions • Manual archiving/management of requests, with transcript on spreadsheet or other formats
  9. 9. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com Fiera Milano Media Editorial Plans Subscriptions New way of Editorial Plan Subscription, via Drupal 7: External user: • Cditorial content selection and details subscription/submit via web Fiera Milano Media Operator/Editor: • Creating and archiving plans and editorial content, year by year, via the CMS backend • Subscriptions and external user accounts management & storage, year by year, via the CMS backend
  10. 10. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com New Editorial Plans Subscriptions Approach & Analysis We had the following needs: • create the relational Editorial Plans Structure (Content Types in Drupal) and make the internal users able to input,create & manage these contents via CMS backend • create Forms able to expose dynamic and relational contents (Entity Referenced) of the Editorial Plans Structure and get subscriptions from to external users • manage and expose (with Views or whatever) Subcriptions and sub details (like Entities) strictly related to the Editorial Plans Contents (Entity Referenced) Why Entity Forms above Webforms ? All those task are: • very hard (probably impossibile …) to be achieved with the Webform Module • easy - logical (and quite natural) to be achieved with Entity Form Module
  11. 11. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com Creation & Management of Editorial Plans Structure Creation of Drupal Content Types: Drupal implementation Magazine Editorial Plan (magazine, number, month year, etc) Editorial Contents (Title, Section, Description, etc.) 1 n (as entity references) Creation of Drupal Management Relational Logics & Views, 
 throughout specific administration links/hook_menus, administration & management views Example Links/Views (local links): 
 http://fieramilanomedianew/it/content/energie-ambiente-oggi-n-16-novembre-2014 Magazine Editorial Plan (magazine, number, month year, etc) Editorial Contents (Title, Section, Description, etc.) 1 n This allows the 
 Creation of an endless and multilingual Archive of Editorial Plans for every Magazine its monthly issue/number and its specific content types (title, section description) for every year
  12. 12. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com Creation of Entity-Form for Editorial Plans Subscriptions Drupal implementation The Entity Form for Editorial Plans Subscriptions is created as a Field-able Drupal Entity. The Entity Form Module makes doing all this very easy, and very similar to the creation of a Drupal Content Type. Entity Forms Fields are just Drupal Fields. In our case besides the usual and constant/text fields for collecting users informations (Name, Company, Email, Address, etc.) we were able to expose (and collect) specific and dynamic informations thorough entity reference fields to the Editorial Plans’ specific Content Types. Here is the implemented Entity Form structure (local link): 
  13. 13. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com In our specific case we had to expose dynamic content (specific Editorial Contents) regarding the specific chosen Year & Magazine Editorial, in a sort of dependent Drop Down Menu Logic. We needed to hardly ‘alter’ the Entity Form to achieve this, injecting a lot of code to implement Ajax Behaviors, in the Drupal compliant way > AJAX Forms in Drupal 7 Magazine Number / Month Year Editorial Contents (1 - n) 1 n The front end of the Entity-Form for Editorial Plans Subscriptions Our Drupal implementation with Ajax Forms Here is our live Entity Form result (external link): 
 www.fieramilanomedia.it/sottoscrivi_piani_editoriali … & Tableselect & JQuery
  14. 14. #DrupalDaysIT Milano - 8 Maggio @ 2014 - italomairo.com The collection & management of Editorial Plans Subscriptions Entity Forms Subscriptions management with Views and Rules modules • Entity Form Subscriptions are Drupal Entities (such as Nodes are) easily managed and exposed with Fields Displays Layouts (Full Content, Teaser, etc) and Drupal Views. • Once submitted by the Form, the data keeps the relation with the Entities (Editorial Plans Content Types) referenced in the form, so that we are able to extend of Editorial Plans Content Types’s Views with the related Subscriptions collected by the Entity Form
 (this is tricky with Webform Subscriptions > needs: webform_mysql_views module) • Besides that
 the Entity Form and each Entity Form Subscription are exposed to the Rules Module (through its Entityforms Notifications module, based on the Entity Rules one), so that “events” might be triggered over Entity Forms Submissions and their data. • We took great advantage of all this in the 
 Fiera Milano Media Editorial Plans Management System … in this way > (local link)
  15. 15. Milano - 8 Maggio @ 2014 - italomairo.com ITALO MAIRO Engineer & Drupal Delevoper Personal Web Site: www.italomairo.com Email: info@italomairo.com Username on drupal.org: itamair LinkedIn: http://it.linkedin.com/in/italomairo/ dealing with Digital Communication, Web 2.0 & Web Gis 2.0 Opensource Applications Thank you …