Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

config_gen_setup_html()

Description

Generate the second half of the "guts" of a plugin setup page from a page definition array. The
page definition array is typically constructed by a series of calls to config_add_xxxx functions
(see below). See the setup page for the sample plugin for information on how to use this and the
associated functions.

If wishing to ouput array of values for one config option, in your setup page have something like the
following which adds a single definition for each key of your config option:
foreach($usergroups as $k => $group)
{
global $usergroupemails;
if(!isset($usergroupemails[$group["ref"]])){$usergroupemails[$group["ref"]]=array();} // Define any missing keys
$page_def[] = config_add_text_list_input("usergroupemails[".$group["ref"]."]",$group["name"]); //need to pass a string that looks like: "$configoption["key"]"
}
The key can consist of numbers, letters or an underscore contained within "" or ''. If using numbers you don't need the quote marks

each of which describes how one of the plugin's configuratoin variables.
typically a $lang[] variable.
placed after the page heading and before the form. Default: '' (i.e., no front matter).

Parameters

ColumnTypeDefaultDescription
$page_def
$plugin_name
$upload_status
$plugin_page_heading
$plugin_page_frontm ''
mixed $page_def an array whose elements are generated by calls to config_add_xxxx functions
string $plugin_page_frontm front matter for the setup page in html format. This material is

Location

include/plugin_functions.php lines 587 to 711

Definition

 
function config_gen_setup_html($page_def,$plugin_name,$upload_status,$plugin_page_heading,$plugin_page_frontm='')
    {
    global 
$lang,$baseurl_short;
?>
    <div class="BasicsBox">

    $links_trail 
= array(
        array(
            
'title' => $lang["systemsetup"],
            
'href'  => $baseurl_short "pages/admin/admin_home.php"
        
),
        array(
            
'title' => $lang["pluginmanager"],
            
'href'  => $baseurl_short "pages/team/team_plugins.php"
        
),
        array(
            
'title' => $plugin_page_heading
        
)
    );
    
renderBreadcrumbs($links_trail);

    if (
$plugin_page_frontm!='')
        {
        echo 
$plugin_page_frontm;
        }
?>
        <form id="form1" name="form1" method="post" action="">
    
    generateFormToken
("form1");

    foreach (
$page_def as $def)
        {
        
$array_offset="";
        if(
preg_match("/\[[\"|']?\w+[\"|']?\]/",$def[1],$array_offset))
            {
            
$array=preg_replace("/\[[\"|']?\w+[\"|']?\]/","",$def[1]);
            
preg_match("/[\"|']?\w+[\"|']?/",$array_offset[0],$array_offset);
            }
        
        
hook ("custom_config_def"'', array($def)); //this comes first so overriding the below is possible
        
        
switch ($def[0])
            {
            case 
'section_header':
                 
config_section_header($def[1], $def[2]);
                 break;
            case 
'html':
                 
config_html($def[1]);
                 break;     
            case 
'text_input':
                
config_text_input($def[1], $def[2], $GLOBALS[$def[1]], $def[3], $def[4], $def[5]);
                break;
            case 
'text_list':
            if (!empty(
$array_offset)) 
                {
                
config_text_input($def[1], $def[2], implode(','$GLOBALS[$array][$array_offset[0]]), $def[3], $def[4]);
                }
            else
                {
                
config_text_input($def[1], $def[2], implode(','$GLOBALS[$def[1]]), $def[3], $def[4]);
                }
                
                break;
            case 
'boolean_select':
                
config_boolean_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3], $def[4]);
                break;
            case 
'single_select':
                
config_single_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3], $def[4], $def[5]);
                break;
            case 
'multi_select':
                
config_multi_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3], $def[4], $def[5]);
                break;
            case 
'single_user_select':
                
config_single_user_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3]);
                break;
            case 
'multi_user_select':
                
config_multi_user_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3]);
                break;            
            case 
'single_ftype_select':
                
config_single_ftype_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3], $def[4], $def[5],$def[6]);
                break;
            case 
'multi_ftype_select':
                
config_multi_ftype_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3],$def[4], $def[5]); 
                break;
            case 
'single_rtype_select':
                
config_single_rtype_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3]);
                break;
            case 
'multi_rtype_select':
                
config_multi_rtype_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3]);
                break;
            case 
'db_single_select':
                
config_db_single_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3], $def[4], $def[5], $def[6], $def[7], $def[8]);
                break;
            case 
'db_multi_select':
                
config_db_multi_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3], $def[4], $def[5], $def[6], $def[7], $def[8]);
                break;
            case 
'single_group_select':
                
config_single_group_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3]);
                break;
            case 
'multi_group_select':
                
config_multi_group_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3]);
                break;
            case 
'checkbox_select':
                
config_checkbox_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3], $def[4], $def[5], $def[6], $def[7], $def[8], $def[9]);
                break;
            case 
'multi_archive_select':
                
config_multi_archive_select($def[1], $def[2], $GLOBALS[$def[1]], $def[3]);
                break;
    
            }
        }
?>
        <div class="Question">
          <label for="submit">&nbsp;</label>
          <input type="submit" name="save" id="save" value=" echo $lang['plugins-saveconfig']?>">
          <input type="submit" name="submit" id="submit" value=" echo $lang['plugins-saveandexit']?>">
          <div class="clearerleft"></div>
        </div>
      </form>

    display_rsc_upload
($upload_status);
?>
    </div>

    
}

This article was last updated 26th November 2020 04:35 Europe/London time based on the source file dated 9th October 2020 10:20 Europe/London time.