array( // 'name' => 'add_edit_category' , // 'method' => 'POST' , // 'action' => '' , // 'attributes' => array() , // 'clientside_validation' => TRUE // ) , // // 'field_specs' => array( // // // ----------------------------------------------------------------------------- // // 'form_field_value_from' OPTIONAL // // // // This tells us where the value displayed in the field comes from, // // whenever the field is displayed (on the form). // // // // NOTE that:- // // // // 1. You have to specify "form_field_value_from" separately, for the "add" and // // "edit" versions of the form. // // // // 2. The following Zebra Form control types DON'T have values to be // // set:- // // o "submit" // // o "button" // // // // So there's NO need to specify "form_field_value_from" for fields with these // // control types. And if you do specify "form_field_value_from", it will be // // IGNORED. // // // // o If specified, "form_field_value_from" should be like:- // // // // array( // // 'add' => array( // // 'method' => 'array_storage_value_from' // // 'instance' => '' // // // (NULL or not specified means use "form_field_name") // // -OR- // // 'method' => 'literal' (The DEFAULT "add" value is the empty string) // // 'instance' => // // -OR- // // 'method' => 'function' // // 'instance' => array( // // 'function_name' => // // 'extra_args' => // // ) , // // 'edit' => array( // // 'method' => 'array_storage_value_from' (This is the DEFAULT) // // 'instance' => '' // // // (NULL or not specified means use "form_field_name") // // -OR- // // array( // // 'method' => 'array_storage_field_value' (This is the DEFAULT) // // 'instance' => '' // // // (NULL or not specified means use "form_field_name") // // -OR- // // 'method' => 'literal' // // 'instance' => // // -OR- // // 'method' => 'function' // // 'instance' => array( // // 'function_name' => // // 'extra_args' => // // ) // // ) // // // // o If "form_field_value_from" - or any of it's components:- // // a) ISN'T specified, // // b) is NULL, or; // // c) is the empty array(), // // // // then things DEFAULT as follows:- // // // // array( // // 'add' => array( // // 'method' => 'literal' , // // 'instance' => '' // // ) , // // 'edit' => array( // // 'method' => 'array-storage-field-value' , // // 'instance' => // // ) // // ) // // // // ----------------------------------------------------------------------------- // // // ----------------------------------------------------------------------------- // // 'constraints' OPTIONAL // // // // NOTE! // // ===== // // These are the "contraints" that apply when SAVING a submitted // // Zebra Form. // // // // If specified, must be an ARRAY containing zero or more sub-arrays. // // Eg:- // // // // array( // // // // array( // // 'method' => 'unique' // // // "instance" and "args", if specified, are ignored // // ) // // // // array( // // 'method' => 'unique-case-insensitively' // // // "instance" and "args", if specified, are ignored // // ) // // // // array( // // 'method' => 'unique-key' // // // "instance" and "args", if specified, are ignored // // ) // // // // array( // // 'method' => 'in-array-strict' // // 'instance' => array(...) // // // "args", if specified, is ignored // // ) // // // // array( // // 'method' => 'in-array-not-strict' // // 'instance' => array(...) // // // "args", if specified, is ignored // // ) // // // // array( // // 'method' => 'function' // // 'instance' => '' // // 'args' => (optional) If specified, should be either // // NULL or a possibly empty array. NULL and // // not specified are converted to the empty // // array. // // ) // // // // ) // // // // If NOT specified, defaults to the empty array. // // ----------------------------------------------------------------------------- // // array( // 'form_field_name' => 'parent_key' , // 'zebra_control_type' => 'select' , // 'label' => 'Project' , // 'form_field_value_from' => NULL , // 'attributes' => array() , // 'rules' => array( // 'required' => array( // 'error' , // variable to add the error message to // 'Field is required' // error message if value doesn't validate // ) // ) , // 'type_specific_args' => array( // 'options_getter_function' => array( // 'function_name' => '\\researchAssistant_byFernTec_datasetManagerDatasetDefs_categories\\get_options_for_project_selector' , // 'extra_args' => NULL // ) // ) , // 'constraints' => array( // array( // 'type' => 'unique-key' // ) // ) // ) , // // array( // 'form_field_name' => 'parent_is' , // 'zebra_control_type' => 'hidden' , // // 'label' => NULL , // 'form_field_value_from' => array( // 'add' => array( // 'method' => 'literal' , // 'instance' => 'project' // ) , // 'edit' => array( // 'method' => 'array-storage-field-value' , // 'instance' => NULL // ) // ) , // 'attributes' => array() , // 'rules' => array( // 'required' => array( // 'error' , // variable to add the error message to // 'Field is required' // error message if value doesn't validate // ) // ) , // 'constraints' => array( // array( // 'type' => 'in-array-strict' , // 'args' => array( 'project' , 'category' ) // ) // ) // ) , // // array( // 'form_field_name' => 'title' , // 'zebra_control_type' => 'text' , // 'label' => 'Title' , // 'attributes' => array() , // 'rules' => array( // 'required' => array( // 'error' , // variable to add the error message to // 'Field is required' // error message if value doesn't validate // ) // ) , // 'constraints' => array( // array( // 'type' => 'unique-case-insensitively' // ) // ) , // 'type_specific_args' => array() // ) , // // array( // 'form_field_name' => 'notes_slash_comments' , // 'zebra_control_type' => 'textarea' , // 'label' => 'Notes/Comments' , // 'attributes' => array() , // 'rules' => array() , // 'type_specific_args' => array() // ) , // // array( // 'form_field_name' => 'save_me' , // 'zebra_control_type' => 'submit' , // 'label' => NULL , // 'attributes' => array() , // 'rules' => array() , // 'type_specific_args' => array( // 'caption' => 'Submit' // ) // ) , // // array( // 'form_field_name' => 'cancel' , // 'zebra_control_type' => 'button' , // 'label' => NULL , // 'attributes' => array( // 'onclick' => $onclick // ) , // 'rules' => array() , // 'type_specific_args' => array( // 'caption' => 'Cancel' , // 'type' => 'button' // ) // ) // // ) , // // 'focus_field_slug' => TRUE // // ) ; // // ------------------------------------------------------------------------- //pr( $selected_datasets_dmdd['zebra_forms'] ) ; // ========================================================================= // Init. // ========================================================================= $ns = __NAMESPACE__ ; $fn = __FUNCTION__ ; // ------------------------------------------------------------------------- $safe_form_slug_underscored = htmlentities( $form_slug_underscored ) ; // ========================================================================= // ISSET ? // ========================================================================= if ( ! array_key_exists( 'zebra_forms' , $selected_datasets_dmdd ) ) { return << add_edit_project // [method] => POST // [action] => // [attributes] => Array() // [clientside_validation] => 1 // ) // // ------------------------------------------------------------------------- $form_specs = $defaulted_zebra_form['form_specs'] ; // To make the following code a little simpler... // ------------------------------------------------------------------------- // name ? // ------------------------------------------------------------------------- if ( isset( $form_specs['name'] ) ) { // --------------------------------------------------------------------- if ( ! is_string( $form_specs['name'] ) || trim( $form_specs['name'] ) === '' || ! \greatKiwi_byFernTec_adSwapper_local_v0x1x210_stringUtils\ctype_alphanumeric_underscore_dash( $form_specs['name'] ) || strlen( $form_specs['name'] ) > 64 ) { return << TRUE , // array( // 'slug' => '<1 to 64 character variable name like string>' // 'form_field_value_from' => array( // 'method' => '<1 to 64 character alphanumeric underscore dash like string>' // ...0 to 2 more args... // ) // ) // ... // ) // // So for all fields:- // o "slug" is set and valid // o "form_field_value_from" is an array - with at least a "method" element. // Where the method name looks to be valid. // // However:- // o Whether or not the field's method name is recognised/supported, // and; // o Whether or not the field's "instance" and "args" elements are // supplied and valid for the method concerned, has NOT been // checked. // // RETURNS:- // On SUCCESS! // - - - - - - // TRUE // And the caller's:- // $all_application_dataset_definitions, and; // $selected_datasets_dmdd // have been updated as follows:- // o ...['array_storage_record_structure']['checked_defaulted_ok'] = TRUE // o With the remaining "array_storage_record_structure" // elements defaulted as required // // On FAILURE! // - - - - - - // $error_message STRING // ------------------------------------------------------------------------- $result = check_and_default_array_storage_record_structure( $caller_app_slash_plugins_global_namespace , $dataset_manager_home_page_title , $caller_apps_includes_dir , $all_application_dataset_definitions , $selected_datasets_dmdd , $dataset_records , $dataset_title , $dataset_slug ) ; // ------------------------------------------------------------------------- if ( is_string( $result ) ) { return $result ; } // ------------------------------------------------------------------------- $array_storage_field_slugs = array() ; // ------------------------------------------------------------------------- //\greatKiwi_byFernTec_adSwapper_local_v0x1x210_testDebug\pr( $selected_datasets_dmdd ) ; foreach ( $selected_datasets_dmdd['array_storage_record_structure'] as $this_index => $this_field ) { if ( $this_index !== 'checked_defaulted_ok' ) { $array_storage_field_slugs[] = $this_field['slug'] ; } } // ========================================================================= // "RAW MODE" ? // ========================================================================= if ( function_exists( '\greatKiwi_byFernTec_adSwapper_local_v0x1x210_standardDatasetManager\is_raw_mode_for_forms' ) && \greatKiwi_byFernTec_adSwapper_local_v0x1x210_standardDatasetManager\is_raw_mode_for_forms() === TRUE ) { $defaulted_zebra_form['auto_create_field_specs'] = array( 'include' => 'all' , 'exclude' => 'none' , 'submit_button' => TRUE , 'cancel_button' => TRUE ) ; $defaulted_zebra_form['focus_field_slug'] = $array_storage_field_slugs[0] ; } // ========================================================================= // AUTO-CREATE the FIELD SPECS ? // ========================================================================= // ------------------------------------------------------------------------- // Here we should have (eg):- // // $defaulted_zebra_form['auto_create_field_specs'] = array( // 'include' => array() , // 'exclude' => array() , // 'submit_button' => TRUE , // 'cancel_button' => TRUE // ) // // ------------------------------------------------------------------------- if ( array_key_exists( 'auto_create_field_specs' , $defaulted_zebra_form ) && is_array( $defaulted_zebra_form['auto_create_field_specs'] ) ) { // ------------------------------------------------------------------------- // auto_create_field_specs( // $defaulted_zebra_form , // $array_storage_field_slugs , // $dataset_title , // $safe_form_slug_underscored // ) // - - - - - - - - - - - - - - - - - - - // RETURNS // o On SUCCESS! // $auto_created_field_specs ARRAY // // o On FAILURE! // $error_message STRING // ------------------------------------------------------------------------- $auto_created_field_specs = auto_create_field_specs( $defaulted_zebra_form , $array_storage_field_slugs , $dataset_title , $safe_form_slug_underscored ) ; // --------------------------------------------------------------------- if ( is_string( $auto_created_field_specs ) ) { return $auto_created_field_specs ; } // --------------------------------------------------------------------- $defaulted_zebra_form['field_specs'] = $auto_created_field_specs ; // --------------------------------------------------------------------- } // ========================================================================= // CHECK/DEFAULT the "FIELD_SPECS"... // ========================================================================= // ------------------------------------------------------------------------- // Here we should have (eg):- // // $selected_datasets_dmdd['zebra_forms'][ $form_slug_underscored ]['field_specs'] = array( // // // ----------------------------------------------------------------------------- // // 'form_field_value_from' OPTIONAL // // // // This tells us where the value displayed in the field comes from, // // whenever the field is displayed (on the form). // // // // NOTE that:- // // // // 1. You have to specify "form_field_value_from" separately, for the "add" and // // "edit" versions of the form. // // // // 2. The following Zebra Form control types DON'T have values to be // // set:- // // o "submit" // // o "button" // // // // So there's NO need to specify "form_field_value_from" for fields with these // // control types. And if you do specify "form_field_value_from", it will be // // IGNORED. // // // // o If specified, "form_field_value_from" should be like:- // // // // array( // // 'add' => array( // // 'method' => 'array_storage_value_from' // // 'instance' => '' // // // (NULL or not specified means use "form_field_name") // // -OR- // // 'method' => 'literal' (The DEFAULT "add" value is the empty string) // // 'instance' => // // -OR- // // 'method' => 'function' // // 'instance' => array( // // 'function_name' => // // 'extra_args' => // // ) , // // 'edit' => array( // // 'method' => 'array_storage_field_slug' (This is the DEFAULT) // // 'instance' => '' // // // (NULL or not specified means use "form_field_name") // // -OR- // // 'method' => 'array_storage_field_value' (This is the DEFAULT) // // 'instance' => '' // // // (NULL or not specified means use "form_field_name") // // -OR- // // 'method' => 'literal' // // 'instance' => // // -OR- // // 'method' => 'function' // // 'instance' => array( // // 'function_name' => // // 'extra_args' => // // ) // // ) // // // // o If "form_field_value_from" - or any of it's components:- // // a) ISN'T specified, // // b) is NULL, or; // // c) is the empty array(), // // // // then things DEFAULT as follows:- // // // // array( // // 'add' => array( // // 'method' => 'literal' , // // 'instance' => '' // // ) , // // 'edit' => array( // // 'method' => 'array-storage-field-value' , // // 'instance' => // // ) // // ) // // // // ----------------------------------------------------------------------------- // // // ----------------------------------------------------------------------------- // // 'constraints' OPTIONAL // // // // NOTE! // // ===== // // These are the "contraints" that apply when SAVING a submitted // // Zebra Form. // // // // If specified, must be an ARRAY containing zero or more sub-arrays. // // Eg:- // // // // array( // // // // array( // // 'method' => 'unique' // // // "instance" and "args", if specified, are ignored // // ) // // // // array( // // 'method' => 'unique-case-insensitively' // // // "instance" and "args", if specified, are ignored // // ) // // // // array( // // 'method' => 'unique-key' // // // "instance" and "args", if specified, are ignored // // ) // // // // array( // // 'method' => 'in-array-strict' // // 'instance' => array(...) // // // "args", if specified, is ignored // // ) // // // // array( // // 'method' => 'in-array-not-strict' // // 'instance' => array(...) // // // "args", if specified, is ignored // // ) // // // // array( // // 'method' => 'function' // // 'instance' => '' // // 'instance' => (optional) If specified, should be either // // NULL or a possibly empty array. NULL and // // not specified are converted to the empty // // array. // // ) // // // // ) // // // // If NOT specified, defaults to the empty array. // // ----------------------------------------------------------------------------- // // array( // 'form_field_name' => 'parent_key' , // 'zebra_control_type' => 'select' , // 'label' => 'Project' , // 'form_field_value_from' => NULL , // 'attributes' => array() , // 'rules' => array( // 'required' => array( // 'error' , // variable to add the error message to // 'Field is required' // error message if value doesn't validate // ) // ) , // 'type_specific_args' => array( // 'options_getter_function' => array( // 'function_name' => '\\researchAssistant_byFernTec_datasetManagerDatasetDefs_categories\\get_options_for_project_selector' , // 'extra_args' => NULL // ) // ) , // 'constraints' => array( // array( // 'type' => 'unique-key' // ) // ) // ) , // // array( // 'form_field_name' => 'parent_is' , // 'zebra_control_type' => 'hidden' , // // 'label' => NULL , // 'form_field_value_from' => array( // 'add' => array( // 'method' => 'literal' , // 'instance' => 'project' // ) , // 'edit' => array( // 'method' => 'array-storage-field-value' , // 'instance' => NULL // ) // ) , // 'attributes' => array() , // 'rules' => array( // 'required' => array( // 'error' , // variable to add the error message to // 'Field is required' // error message if value doesn't validate // ) // ) , // 'constraints' => array( // array( // 'type' => 'in-array-strict' , // 'args' => array( 'project' , 'category' ) // ) // ) // ) , // // array( // 'form_field_name' => 'title' , // 'zebra_control_type' => 'text' , // 'label' => 'Title' , // 'attributes' => array() , // 'rules' => array( // 'required' => array( // 'error' , // variable to add the error message to // 'Field is required' // error message if value doesn't validate // ) // ) , // 'constraints' => array( // array( // 'type' => 'unique-case-insensitively' // ) // ) , // 'type_specific_args' => array() // ) , // // array( // 'form_field_name' => 'notes_slash_comments' , // 'zebra_control_type' => 'textarea' , // 'label' => 'Notes/Comments' , // 'attributes' => array() , // 'rules' => array() , // 'type_specific_args' => array() // ) , // // array( // 'form_field_name' => 'save_me' , // 'zebra_control_type' => 'submit' , // 'label' => NULL , // 'attributes' => array() , // 'rules' => array() , // 'type_specific_args' => array( // 'caption' => 'Submit' // ) // ) , // // array( // 'form_field_name' => 'cancel' , // 'zebra_control_type' => 'button' , // 'label' => NULL , // 'attributes' => array( // 'onclick' => $onclick // ) , // 'rules' => array() , // 'type_specific_args' => array( // 'caption' => 'Cancel' , // 'type' => 'button' // ) // ) // // ) ; // // ------------------------------------------------------------------------- if ( ! array_key_exists( 'field_specs' , $defaulted_zebra_form ) ) { return << $field_details ) { // ===================================================================== // Field ERROR CHECKING... // ===================================================================== $field_number = $field_index + 1 ; // --------------------------------------------------------------------- // field details ? // --------------------------------------------------------------------- if ( ! is_array( $field_details ) ) { return << 64 ) { return << 32 ) { return << 'unique' // // "instance" and "args", if specified, are ignored // ) // // array( // 'method' => 'unique-case-insensitively' // // "instance" and "args", if specified, are ignored // ) // // array( // 'method' => 'unique-key' // // "instance" and "args", if specified, are ignored // ) // // array( // 'method' => 'in-array-strict' // 'instance' => array(...) // // "args", if specified, is ignored // ) // // array( // 'method' => 'in-array-not-strict' // 'instance' => array(...) // // "args", if specified, is ignored // ) // // array( // 'method' => 'function' // 'instance' => '' // 'args' => (optional) If specified, should be either // NULL or a possibly empty array. NULL and // not specified are converted to the empty // array. // ) // // ) // // If NOT specified, defaults to the empty array. // ----------------------------------------------------------------------------- if ( isset( $field_details['constraints'] ) ) { if ( $field_details['constraints'] === NULL ) { $defaulted_field_details['constraints'] = array() ; } elseif ( is_array( $field_details['constraints'] ) ) { // ------------------------------------------------------------- foreach ( $field_details['constraints'] as $constraint_index => $this_constraint ) { // --------------------------------------------------------- $constraint_number = $constraint_index + 1 ; // --------------------------------------------------------- if ( ! is_array( $this_constraint ) ) { return << array( // 'method' => 'array_storage_value_from' // 'instance' => '' // // (NULL or not specified means use "form_field_name") // -OR- // 'method' => 'literal' (The DEFAULT "add" value is the empty string) // 'instance' => // -OR- // 'method' => 'function' // 'instance' => array( // 'function_name' => // 'extra_args' => // ) , // 'edit' => array( // 'method' => 'array_storage_value_from' (This is the DEFAULT) // 'instance' => '' // // (NULL or not specified means use "form_field_name") // -OR- // 'method' => 'array_storage_field_value' (This is the DEFAULT) // 'instance' => '' // // (NULL or not specified means use "form_field_name") // -OR- // 'method' => 'literal' // 'instance' => // -OR- // 'method' => 'function' // 'instance' => array( // 'function_name' => // 'extra_args' => // ) // ) // // o If "form_field_value_from" - or any of it's components:- // a) ISN'T specified, // b) is NULL, or; // c) is the empty array(), // // then things DEFAULT as follows:- // // array( // 'add' => array( // 'method' => 'literal' , // 'instance' => '' // ) , // 'edit' => array( // 'method' => 'array-storage-field-value' , // 'instance' => // ) // ) // // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // Here we should have (eg):- // // $field_details = Array( // [form_field_name] => pathspec // [zebra_control_type] => text // [label] => Pathspec // [attributes] => Array() // [rules] => Array( // [required] => Array( // [0] => error // [1] => Field is required // ) // ) // ) // // ------------------------------------------------------------------------- //pr( $field_details ) ; // ========================================================================= // Init. // ========================================================================= $ns = __NAMESPACE__ ; $fn = __FUNCTION__ ; // ========================================================================= // Ignore the Zebra Form controls that have no "default value"... // ========================================================================= if ( in_array( $field_details['zebra_control_type'] , get_zebra_controls_with_no_default_value() , TRUE ) ) { return TRUE ; } // ========================================================================= // Set the DEFAULT VALUE WHEN ADDING'.. // ========================================================================= if ( $field_details['zebra_control_type'] === 'checkbox' ) { $default_when_adding = FALSE ; } else { $default_when_adding = '' ; } // ========================================================================= // ISSET ? // ========================================================================= if ( ! isset( $field_details['form_field_value_from'] ) || $field_details['form_field_value_from'] === NULL || ( is_array( $field_details['form_field_value_from'] ) && count( $field_details['form_field_value_from'] ) === 0 ) ) { // --------------------------------------------------------------------- // Set the DEFAULT "form_field_value_from"... // --------------------------------------------------------------------- if ( ! in_array( $field_details['form_field_name'] , $array_storage_field_slugs , TRUE ) ) { return << array( 'method' => 'literal' , 'instance' => $default_when_adding ) , 'edit' => array( 'method' => 'array-storage-field-value' , 'instance' => $field_details['form_field_name'] ) ) ; // --------------------------------------------------------------------- return TRUE ; // --------------------------------------------------------------------- } // ========================================================================= // "form_field_value_from" must be an ARRAY... // ========================================================================= if ( ! is_array( $field_details['form_field_value_from'] ) ) { return << 'literal' , 'instance' => $default_when_adding ) ; // --------------------------------------------------------------------- } // ========================================================================= // "form_field_value_from" + "edit" // ========================================================================= if ( isset( $field_details['form_field_value_from']['edit'] ) ) { // --------------------------------------------------------------------- $add_edit = 'edit' ; // --------------------------------------------------------------------- $result = check_and_default_form_field_value_from__method_and_args( $dataset_title , $field_number , $array_storage_field_slugs , $safe_form_slug_underscored , $field_details , $add_edit ) ; // --------------------------------------------------------------------- if ( is_string( $result ) ) { return $result ; } // --------------------------------------------------------------------- } else { // --------------------------------------------------------------------- // Set the DEFAULT 'edit'... // --------------------------------------------------------------------- if ( ! in_array( $field_details['form_field_name'] , $array_storage_field_slugs , TRUE ) ) { return << 'array-storage-field-value' , 'instance' => $field_details['form_field_name'] ) ; // --------------------------------------------------------------------- } // ========================================================================= // SUCCESS! // ========================================================================= return TRUE ; // ========================================================================= // That's that! // ========================================================================= } // ============================================================================= // check_and_default_form_field_value_from__method_and_args() // ============================================================================= function check_and_default_form_field_value_from__method_and_args( $dataset_title , $field_number , $array_storage_field_slugs , $safe_form_slug_underscored , &$field_details , $add_edit ) { // ------------------------------------------------------------------------- // check_and_default_form_field_value_from__method_and_args( // $dataset_title , // $field_number , // $array_storage_field_slugs , // $safe_form_slug_underscored , // &$field_details , // $add_edit // ) // - - - - - - - - - - - - - - - - - - - // Checks and defaults:- // $field_details['form_field_value_from']['add'] or; // $field_details['form_field_value_from']['edit'] // // (and it's members) as required. // // RETURNS // o On SUCCESS // TRUE // // o On FAILURE // $error_message STRING // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // Here we should have (eg):- // // $field_details['form_field_value_from'] = array( // // 'add' => array( // 'method' => 'array-storage-value_from' // 'instance' => "xxx" (array storage field slug to get value from) // -OR- // 'method' => 'literal' (The DEFAULT "add" value is the empty string) // 'instance' => // -OR- // 'method' => 'function' // 'instance' => array( // 'name' => // 'extra_args' => // ) // ) // // 'edit' => array( // 'method' => 'array-storage-value_from' (This is the DEFAULT) // 'instance' => "xxx" (array storage field slug to get value from) // -OR- // 'method' => 'array-storage-field-value' (This is the DEFAULT) // 'instance' => "xxx" (array storage field slug to get value from) // -OR- // 'method' => 'literal' // 'instance' => // -OR- // 'method' => 'function' // 'instance' => array( // 'name' => // 'extra_args' => // ) // ) // // ) // // ------------------------------------------------------------------------- // ========================================================================= // Init. // ========================================================================= $ns = __NAMESPACE__ ; $fn = __FUNCTION__ ; // ========================================================================= // ERROR CHECKING... // ========================================================================= // ------------------------------------------------------------------------- // "add/edit" must be an array... // ------------------------------------------------------------------------- if ( ! is_array( $field_details['form_field_value_from'][ $add_edit ] ) ) { return << "all" (default) // --OR-- // array( // "" // "" // ... // "" // ) , // // 'exclude' => "none" (default) // --OR-- // array( // "" // "" // ... // "" // ) , // // 'submit_button' => TRUE | FALSE | "" , // // 'cancel_button' => TRUE | FALSE | "" // // ) // // All the above "auto_create_field_specs" array members are OPTIONAL. // // "submit_button" and "cancel_button" both default to FALSE. // ------------------------------------------------------------------------- // ========================================================================= // Init. // ========================================================================= $ns = __NAMESPACE__ ; $fn = __FUNCTION__ ; // ========================================================================= // include ? // ========================================================================= if ( ! array_key_exists( 'include' , $defaulted_zebra_form['auto_create_field_specs'] ) || $defaulted_zebra_form['auto_create_field_specs']['include'] === 'all' ) { // --------------------------------------------------------------------- $include = $array_storage_field_slugs ; // --------------------------------------------------------------------- } elseif ( ! is_array( $defaulted_zebra_form['auto_create_field_specs']['include'] ) ) { // --------------------------------------------------------------------- return << $this_field_spec ) { // ----------------------------------------------------------------- $field_number = $this_index + 1 ; // ----------------------------------------------------------------- if ( ! array_key_exists( 'form_field_name' , $this_field_spec ) ) { return << $this_array_storage_field_slug , 'zebra_control_type' => 'text' , 'attributes' => array( 'style' => 'width:98%' ) ) ; // --------------------------------------------------------------------- } // ========================================================================= // SUBMIT BUTTON ? // ========================================================================= if ( $submit_button_text !== '' ) { // --------------------------------------------------------------------- $new_field_specs[] = array( 'form_field_name' => 'save_me' , 'zebra_control_type' => 'submit' , 'label' => NULL , 'attributes' => array() , 'rules' => array() , 'type_specific_args' => array( 'caption' => $submit_button_text ) ) ; // --------------------------------------------------------------------- } // ========================================================================= // CANCEL BUTTON ? // ========================================================================= if ( $cancel_button_text !== '' ) { // --------------------------------------------------------------------- $get_cancel_button_onclick_attribute_value_function_name = '\\greatKiwi_byFernTec_adSwapper_local_v0x1x210_standardDatasetManager' . '\\get_cancel_button_onclick_attribute_value' ; // --------------------------------------------------------------------- $new_field_specs[] = array( 'form_field_name' => 'cancel' , 'zebra_control_type' => 'button' , 'label' => NULL , 'dynamic_attributes' => array( 'onclick' => array( 'function_name' => $get_cancel_button_onclick_attribute_value_function_name , 'extra_args' => NULL ) ) , 'rules' => array() , 'type_specific_args' => array( 'caption' => $cancel_button_text , 'type' => 'button' ) ) ; // --------------------------------------------------------------------- } // ========================================================================= // SUCCESS! // ========================================================================= return $new_field_specs ; // ========================================================================= // That's that! // ========================================================================= } // ========================================================================= // Zebra-Form Field Types and Their Parameters // - - - - - - - - - - - - - - - - - - - - - - // // button // id // caption // attributes // type = 'button' // // captcha // id // attach_to // $storage = 'cookie' // // checkbox // id // value // attributes // // date // id // default // attributes // // file // id // attributes // // hidden // id // default // // image // id // src // attributes // // label // id // attach_to // caption // attributes // // note // id // attach_to // caption // attributes // // password // id // default // attributes // // radio // id // value // attributes // // reset // id // caption // attributes // // select // id // default // attributes // default_other // // submit // id // caption // attributes // // text // id // default // attributes // // textarea // id // default // attributes // // time // id // default // attributes // // ========================================================================= // ========================================================================= // Zebra-Form "Rules" // ------------------ // See "set_rule()" method in the Zebra-Form docs for descriptions of the // individual rules... // // alphabet // alphanumeric // captcha // compare // convert // custom // date // datecompare // dependencies // digits // email // emails // filesize // filetype // float // image // length // number // regexp // required // resize // upload // url // // ========================================================================= // ============================================================================= // That's that! // =============================================================================