phpBB

Development Wiki

Difference between revisions of "Build cfg template"

From phpBB Development Wiki

(Examples)
(Description)
Line 2: Line 2:
  
 
==Description==
 
==Description==
 +
<code>function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)</code>
 
This function is used in the ACP to build configuration pages and cuts down on all the INPUT fields and allows you to create a simple array of all the fields you need to set, along with limits, validation, etc...
 
This function is used in the ACP to build configuration pages and cuts down on all the INPUT fields and allows you to create a simple array of all the fields you need to set, along with limits, validation, etc...
  
Line 9: Line 10:
  
 
This last array is the key to the configuration settings.
 
This last array is the key to the configuration settings.
 +
 
==Parameters==
 
==Parameters==
 
{|border="1" cellspacing="0" cellpadding="3"
 
{|border="1" cellspacing="0" cellpadding="3"

Revision as of 23:52, 8 September 2008

Function: build_cfg_template();

Description

function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) This function is used in the ACP to build configuration pages and cuts down on all the INPUT fields and allows you to create a simple array of all the fields you need to set, along with limits, validation, etc...

The main area to look at is the $display_vars['vars'] part of the array.

$display_vars['vars'][$config_key] => configuration_settings_array()

This last array is the key to the configuration settings.

Parameters

Key Description Valid Type
lang Text label
validate Expected data type
  • bool
  • int
  • lang
  • string
  • wpath
type Type of field
  • dimension
  • custom
  • password
  • radio
  • select
  • string
  • text
  • textarea
  • false
explain Show explain text
  • false
  • true
method A function inside your acp class to create screen output, generally used for optional elements <OPTION name=foo>FOO_LABEL</OPTION>
function A function not inside your acp class to create screen output, generally used for optional elements <OPTION name=foo>FOO_LABEL</OPTION>
params Input parameters to use with the function or method
append Any text that follows the form field

Examples

$display_vars = array(
    
'title'    => 'ACP_FOO',
    
'vars'    => array(
        
'legend1'        => 'GENERAL_FOO',
        
'foo1'           => array('lang' => 'ALLOW_BAR',  'validate' => 'bool',    'type' => 'radio:yes_no',   'explain' => false),
        
'foo2'           => array('lang' => 'MAX_BAR',    'validate' => 'int:0',   'type' => 'text:5:4',       'explain' => true),
        
'foo3'           => array('lang' => 'BAR_TYPE',   'validate' => 'string',  'type' => 'custom',     'method' => 'bar_type''explain' => true),
    ),
);