Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Unlimited Value Fields #178

Open
signalpoint opened this issue Sep 6, 2013 · 8 comments
Open

Add Support for Unlimited Value Fields #178

signalpoint opened this issue Sep 6, 2013 · 8 comments

Comments

@signalpoint
Copy link
Owner

This issue cannot be resolved until this Services issue is resolved: https://www.drupal.org/node/2224803

signalpoint added a commit that referenced this issue Sep 6, 2013
…rupalgap_form_get_element_id() to append a delta value if one is provided as an argument. Changed _drupalgap_form_render_element() to fall back to using any hook_field_widget_form() implementations available. Changed drupalgap_field_info_instances_add_to_form() to start using a language code, still need to plug in delta value here.
signalpoint added a commit that referenced this issue Sep 8, 2013
…ement_id() to take in an optional language code and delta as arguments which are appended to the id. Changed drupalgap_form_state_values_assemble() and drupalgap_field_info_instances_add_to_form() to take into consideration language codes and delta values on field elements. Changed drupalgap_form_load() when iterating over elements, to generate the element's id and options attributes id.
signalpoint added a commit that referenced this issue Sep 8, 2013
…ccount the language code and delta values of the form state values when assembling the entity.
signalpoint added a commit that referenced this issue Sep 10, 2013
…eld_info_instance instead of doing it in _drupalgap_form_render_element(). They are still attached to the variables by _drupalgap_form_render_element() before sent off to the theme system though.
signalpoint added a commit that referenced this issue Sep 10, 2013
…elta values. Changed drupalgap_form_load() to check field cardinality and then append field item(s) by delta value onto the element's language code object.
signalpoint added a commit that referenced this issue Sep 10, 2013
…element item deltas and pass them along to hook_field_widget_form(). Added start to text_field_widget_form().
signalpoint added a commit that referenced this issue Sep 11, 2013
…if the element is a field, if it is a flat element, it converts it into a single item, so the iteration and themeing can be shared regardless of the type of element.
signalpoint added a commit that referenced this issue Sep 12, 2013
…le_get_element_value() using code extracted from drupalgap_form_state_values_assemble(). Changed drupalgap_form_state_values_assemble() to properly iterate over field delta values. Changed _drupalgap_form_render_element() to again run the element item(s) through the theme system after preprocessing the item based on its type. Changed drupalgap_entity_build_from_form_state() to properly iterate over field delta items. Temporarily commented out image_form_alter(). Changed drupalgap_node_assemble_data() to properly iterate over field item delta(s).
signalpoint added a commit that referenced this issue Sep 13, 2013
…ment_item_load() _drupalgap_form_add_another_item(), drupalgap_form_get_element_container_class(), drupalgap_form_element_item_create(), drupalgap_form_local_storage_save(), drupalgap_form_local_storage_load(), _drupalgap_form_render_element_item(), _drupalgap_form_element_items_widget_load(), _drupalgap_form_element_items_widget_arguments(). Changed drupalgap_form_load() to use drupalgap_form_element_item_create(). Changed drupalgap_form_load() to use drupalgap_form_local_storage_save(). Changed _drupalgap_form_render_element() to use _drupalgap_form_element_items_load() and _drupalgap_form_render_element_item(), it also places an 'add another item' button on unlimited value field elements. Changed _drupalgap_form_submit() to use drupalgap_form_local_storage_load().
signalpoint added a commit that referenced this issue Oct 19, 2013
…' even if there isn't a delta value present. Changed drupalgap_form_load() to properly initialize and merge field items, instead of overriding pre set items.
signalpoint added a commit that referenced this issue Oct 23, 2013
…utes. Changed _drupalgap_form_render_element() to make the call to hook_field_widget_form() when it is iterating over the items. Changed _drupalgap_form_render_element_item() to attach a default value to the variables before they are sent to the theme() layer. Changed drupalgap_field_info_instances_add_to_form() to iterate over each item in the field. Changed text_field_widget_form() to set the type on the items collection, since we no longer need to modify the form element items here, neat-o.
signalpoint added a commit that referenced this issue Oct 24, 2013
…_form_cancel_button(). Added drupalgap_form_element_get_module_name(). Changed _drupalgap_form_render_element() to choose a module to look to for the hook_field_widget_form() implementation on field elements and flat elements, migrated element preprocess modifications to their corresponding hook_field_widget_form() implementation, merged the element item values into theme's variables before sending to theme(), and set a default value onto theme's variables for form elements. Changed theme_radios() and theme_select() to ignore the attributes placed inside options. Changed drupalgap_field_info_instances_add_to_form() to change null default values to an empty string. Added options_field_widget_form() and image_field_widget_form(). Added a default cancel button to system settings forms.
@signalpoint
Copy link
Owner Author

This code has all been merged into the 7.x-1.x-alpha branch!

@signalpoint signalpoint changed the title Forms API has no Concept of Multi-Value Fields Add Support for Unlimited Value Fields Mar 17, 2015
@jomarocas
Copy link

Hi @signalpoint wih the last patch in services here the patch https://www.drupal.org/files/issues/multivalue_fields_fix-2224803-35.patch . Can working multivalues for register and edit nodes? thanks again

@signalpoint
Copy link
Owner Author

@jomarocas Thank you for pointing this out, I've been anxiously waiting to try that patch, I'm glad to hear it works. It will still take some significant effort to support unlimited values in DrupalGap. Multi values should work fine, just not unlimited.

@jomarocas
Copy link

@signalpoint Hi, is possible that i want a button to add more in drupal fields doesn't matter if unlimited or 4 or 9 fields but a button to tells add more, this functionaltiy exist?

@signalpoint
Copy link
Owner Author

@jomarocas I started on a function to help with this _drupalgap_form_add_another_item() - https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/includes/form.inc.js

But once I found out about the limitations in Services in regards to unlimited value fields, I ceased development on it. Plus throughout DrupalGap core, I automatically convert unlimited value fields to single value fields. But it sounds like we're finally getting close to resolving this in Services, at which point I'd be willing to work on this again in DrupalGap.

@luxio
Copy link

luxio commented Jul 9, 2016

I have enabled _drupalgap_form_add_another_item() in order to support unlimited value fields. _drupalgap_form_add_another_item() only adds the output of _drupalgap_form_render_element_item()to the DOM (e.g. <input id="edit-node-edit-field-multiple-text-field-und-1-value" value="" class="" type="text">).

How do I add the complete div (with label, ...)?

Should I use _drupalgap_form_render_element instead of _drupalgap_form_render_element_item?

@signalpoint
Copy link
Owner Author

@luxio The rendering of the label is unfortunately buried within _drupalgap_form_render_element(), it would be best if it could be abstracted out of there. Then both _drupalgap_form_render_element() and _drupalgap_form_render_element_item() can use it, e.g. _drupalgap_form_element_label().

@luxio
Copy link

luxio commented Jul 15, 2016

I have submitted a pull request (#824)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants