Skip to content

Conversation

@midnight-studios
Copy link
Contributor

@midnight-studios midnight-studios commented Apr 12, 2018

Usage

The features these changes provides can be used in different use cases of which will most commonly be utilized by plugins.

Use case example

An example will be a survey form. The admin may wish to create a form that may require numerous form input fields.

Some might be as simple as question and answer consisting of some Question Text and a feedback/answer text input field, however the admin might wish to use more complex feedback options, such as a radio group, checklist or select list. This will require the plugin to support more complex functionality as the admin would be required to add input properties such as option values and labels.

Each Form Input Item may consist of any of the following types:

  • 'select'
  • 'integer'
  • 'html_input'
  • 'html_textarea'
  • 'textarea'
  • 'text'
  • 'checkbox'
  • 'checklist'
  • 'radio'
  • 'fileselect'
  • 'password'
  • 'info'
  • 'color'
  • 'input_group'

Each Form Input will be added dynamically in order to build the form as needed, and each input property will also be required to be added dynamically for some inputs such as lists, may need only two or three list items, while others may be more.

This feature therefor provides support for nested dynamic inputs such as types 'select_input' inside array:array:string.

Additional use case examples will include complex settings for a shopping cart plugin, courier/shipping plugin, layer slider plugin

Changes

This branch contains support for a feature not available in the Official Branch:

Configurations:

  • type = select_input
  • max_number = 4
  • use_fieldset = true / false (Wrap the items in a fieldset)
  • fold = true / false

Supports:

  • 'select'
  • 'integer'
  • 'html_input'
  • 'html_textarea'
  • 'textarea'
  • 'text'
  • 'checkbox'
  • 'checklist'
  • 'radio'
  • 'fileselect'
  • 'password'
  • 'info'
  • 'color'
  • 'input_group'

Related PR

This PR incorporates all the following:

Forum Discussions

http://forums.b2evolution.net/support-dynamic-fields-inside-dynamic-fields#c110631
http://forums.b2evolution.net/feature-request-dynamic-input-groups#c110422

Visual Cues

1
2
3
4
5
7

Additional fixes

fix removing and re-adding items via AJAX callbacks

6

Fixes for dynamic types: array:array:string
Support for new dynamic type: select_input
Support for nested dynamic types
init JS for several ctrl
Made $Blog available in global
Read me updadtes
@yurabakhtin
Copy link
Contributor

@fplanque @midnight-studios I have tested new setting type select_input, please see my screenshot. As I understand the new select_input is a multiple version of existing type input_group to allow add several such groups dynamically.

test_select_input.png

@midnight-studios
Copy link
Contributor Author

midnight-studios commented May 1, 2018

@yurabakhtin the max number on form submitting issue as per your screenshot is fixed in 8400127 i also included additional types samples handled by 'select_input' 862516a, also note that dynamic calls don't work on Skin Settings as per below bug report and this bug has no relation to (caused by) this pull request

http://forums.b2evolution.net/bug-6-9-x-dynamic-plugin-settings-not

- Wrap setting in fieldset to avoid layout breaking
NOTE> Layout breaks when setting (input) is not placed insided a fieldset, this should be fixed

- Added color field for more testing options
fixes for types input_group and select_input
@midnight-studios
Copy link
Contributor Author

midnight-studios commented May 3, 2018

@yurabakhtin I addressed all the issues in your screenshot:

  • Fixed max number on form submitting issue 8400127
  • Placed setting inside fieldset to avoid layout from breaking 582bd96
  • Fixed loading default values in dynamic calls bd37c50
  • Fixed type array:array:string for skin settings: 7447189

@yurabakhtin
Copy link
Contributor

@midnight-studios I have tested last version of this PR and yes it seems it works without errors, thanks.
So a difference between existent type "Dynamic Type array:array:string" and your new added "Select Input select_input" is that "Select Input" allows user to select what field or group of field will be added, but the "Dynamic Type" adds only a specific set of the fields which are defined in config of skin/plugin/widget.

@midnight-studios
Copy link
Contributor Author

@yurabakhtin that is 100% accurate. Thanks

@fplanque fplanque merged commit cf60976 into b2evolution:develop Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Unclear goal It is unclear why we need to add this code/feature (besides "because we can")

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants