Modify Drupal entityreference_autocreate (ERA) module to autocreate a entity with the same title.
The ERA module's code (considering its usefulness) is very lightweight and very well documented.
Currently, ERA will check to see if a node exists depending on the name of the title. If title exist, ERA will NOT autocreate a new node.
The issue with this, in 'our use case' is that sometimes we DO WANT ERA to autocreate a new node with the same title.
We feel the solution is to let the user decide whether or not to autocreate the node, by clicking on a toggle button, aka switch.
So for this project:
Create a toggle button next to the ERA input box. Modify ERA to evaluate the toggle button.
We will also need for you to create a new 'data' attribute ie. 'data-era-toggle' on ERA's existing input selector.
This attribute is for a joint project. As we are also working on a views ui dialog (similar to the token ui dialog drupal admin has) in where the user can select from existing items and the nid is applied to the 'data' attribute.
Modify ERA to also get this data-era-toggle attribute, ie. if not empty && is_numeric, use this nid, in its evaluations. Currently ERA uses entity id retrieved from the autocomplete or the value in the input box to determine if the item exist. By supplying the nid, we can skip all that and target the nid perfectly. And if it's an empty value (no nid), let ERA do its normal validations.
The only details left is the js, which is simple click,focus,removeClass,addClass,etc.. The button styling we will post in later project, along with other styling requirements for other elements.
12 威客就此工作平均出价 $236
++ This is my job. I'm ready to begin now. Pm for me. Thanks Looking forward to hear from you, Feel free to talk about this interesting stuff, give us any questions you have to know more about us ;-) Thanks Oleg!