stevector / plugin-haikus

Drupalcon Portland 2013 Presentation with Pedro Cambra
0 stars 0 forks source link

Entity reference haiku #1

Open pcambra opened 11 years ago

pcambra commented 11 years ago

Current entity reference haiku:

"Even field module Has plugins extending it. Beats huge form alters."

Needs some work, ER plugins are for two things: behaviours and selection, behaviours define how the relationship is made or to react on ER CRUD, for instance ER ships with a taxonomy behavior plugin that updates taxonomy_build_node_index whenever a term id is added to a node, to mimic term reference field. Selection plugins are to modify the selection form settings and widget, what I'll demonstrate is how I needed to provide a plugin for Commerce Coupon module, that has a field for coupon code but the id (target id) is different, so I needed to provide a diferent label for the autocomplete widget: http://drupalcode.org/project/commerce_coupon.git/blob/refs/heads/7.x-1.x:/plugins/selection/EntityReference_SelectionHandler_Generic_commerce_coupon.class.php

pcambra commented 11 years ago

Proposal:

"React on selection or change autocomplete. Used to be harder"