phpBB

Development Wiki

Build cfg template

From phpBB Development Wiki

Revision as of 23:48, 8 September 2008 by Technocrat (Talk | contribs)

Function: build_cfg_template();

Description

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),
    ),
);