Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
PFFormInput Class Reference
Inheritance diagram for PFFormInput:
Inheritance graph
[legend]

Public Member Functions

 __construct ( $input_number, $cur_value, $input_name, $disabled, array $other_args)
 
 getDefaultParameters ()
 
 getHtmlText ()
 
 getJsInitFunctionData ()
 
 getJsValidationFunctionData ()
 
 getResourceModuleNames ()
 
 addJsInitFunctionData ( $name, $param=null)
 
 addJsValidationFunctionData ( $name, $param='null')
 
 addJavaScript ()
 

Static Public Member Functions

static getName ()
 
static getHandledPropertyTypes ()
 
static getParameters ()
 
static canHandleLists ()
 
static getDefaultPropTypes ()
 
static getDefaultPropTypeLists ()
 
static getOtherPropTypesHandled ()
 
static getOtherPropTypeListsHandled ()
 
static getDefaultCargoTypes ()
 
static getDefaultCargoTypeLists ()
 
static getOtherCargoTypesHandled ()
 
static getOtherCargoTypeListsHandled ()
 

Protected Attributes

 $mInputNumber
 
 $mCurrentValue
 
 $mInputName
 
 $mIsMandatory
 
 $mIsDisabled
 
 $mOtherArgs
 
 $mJsInitFunctionData = array()
 
 $mJsValidationFunctionData = array()
 

Detailed Description

Parent class for all form input classes.

Constructor & Destructor Documentation

◆ __construct()

PFFormInput::__construct (   $input_number,
  $cur_value,
  $input_name,
  $disabled,
array  $other_args 
)
Parameters
string$input_numberThe number of the input in the form. For a simple HTML input element this should end up in the id attribute in the format 'input_<number>'.
string$cur_valueThe current value of the input field. For a simple HTML input element this should end up in the value attribute.
string$input_nameThe name of the input. For a simple HTML input element this should end up in the name attribute.
bool$disabledIs this input disabled?
array$other_argsAn associative array of other parameters that were present in the input definition.

Member Function Documentation

◆ addJavaScript()

PFFormInput::addJavaScript ( )

Add the necessary JavaScript for this input.

◆ addJsInitFunctionData()

PFFormInput::addJsInitFunctionData (   $name,
  $param = null 
)

For each input type one or more JavaScript initialization functions may be specified.

This function is not used yet.

They are called to initialize the input after the page html has loaded (or for "multiple" templates after the page fragment has loaded).

The JavaScript function specified here must be in the top level scope of the document. When it is called it will get the input's id attribute as the first parameter and the specified param as the second.

Examples:

Adding initFoo like this: addJsInitFunctionData( "initFoo", "'bar'" ); will result in this JavaScript call: initFoo( inputID, 'bar' );.

Adding initFoo like this: addJsInitFunctionData( "initFoo", "array('bar', 'baz'" ); will result in this JavaScript call: initFoo( inputID, array('bar', 'baz') );.

Parameters
string$nameThe name of the initialization function.
string | null$paramThe parameter passed to the initialization function.

◆ addJsValidationFunctionData()

PFFormInput::addJsValidationFunctionData (   $name,
  $param = 'null' 
)

For each input type one or more JavaScript validation functions may be specified.

Not used yet.

They are called to validate the input before the form is submitted for saving or preview.

The JavaScript function specified here must be in the top level scope of the document. When it is called it will get the input's id attribute as the first parameter and the specified param as the second.

Examples:

Adding validateFoo like this: addJsValidationFunctionData( "initFoo", "'bar'" ); will result in this JavaScript call: validateFoo( inputID, 'bar' );.

Adding validateFoo like this: addJsValidationFunctionData( "initFoo", "array('bar', 'baz'" ); will result in this JavaScript call: validateFoo( inputID, array('bar', 'baz') );.

Parameters
string$nameThe name of the initialization function.
string$paramThe parameter passed to the initialization function.

◆ canHandleLists()

static PFFormInput::canHandleLists ( )
static
Returns
bool True, if this input type can handle lists

◆ getDefaultParameters()

PFFormInput::getDefaultParameters ( )

Return an array of the default parameters for this input where the parameter name is the key while the parameter value is the value.

Returns
string[]

◆ getDefaultPropTypeLists()

static PFFormInput::getDefaultPropTypeLists ( )
static

Returns the set of SMW property types for which this input is meant to be the default one - ideally, no more than one input should declare itself the default for any specific type.

Deprecated:
Returns
array[] key is the property type, value is an array of default args to be used for this input

◆ getDefaultPropTypes()

static PFFormInput::getDefaultPropTypes ( )
static

Returns the set of SMW property types for which this input is meant to be the default one - ideally, no more than one input should declare itself the default for any specific type.

Deprecated:
Returns
array[] key is the property type, value is an array of default args to be used for this input

◆ getHandledPropertyTypes()

static PFFormInput::getHandledPropertyTypes ( )
static

Returns the set of SMW property types which this input can handle. See SMW's SMW_DataValueFactory.php

Returns
string[]

◆ getHtmlText()

PFFormInput::getHtmlText ( )

Returns the HTML code to be included in the output page for this input.

Ideally this HTML code should provide a basic functionality even if the browser is not JavaScript capable. I.e. even without JavaScript the user should be able to input values.

Returns
null

◆ getJsInitFunctionData()

PFFormInput::getJsInitFunctionData ( )

Returns the name and parameters for the initialization JavaScript function for this input type, if any.

This function is not used yet.

Returns
array[]

◆ getJsValidationFunctionData()

PFFormInput::getJsValidationFunctionData ( )

Returns the name and parameters for the validation JavaScript functions for this input type, if any.

This function is not used yet.

Returns
array[]

◆ getName()

static PFFormInput::getName ( )
static

Returns the name of the input type this class handles.

This is the name to be used in the field definition for the "input type" parameter.

Returns
String The name of the input type this class handles. Should be declared abstract. Static functions cannot be abstract. Do we need this method at all? The name should be set outside this class when the input type is registered.

◆ getOtherPropTypeListsHandled()

static PFFormInput::getOtherPropTypeListsHandled ( )
static

Returns the set of SMW property types which this input can handle, but for which it isn't the default input.

Deprecated:
Returns
string[]

◆ getOtherPropTypesHandled()

static PFFormInput::getOtherPropTypesHandled ( )
static

Returns the set of SMW property types which this input can handle, but for which it isn't the default input.

Deprecated:
Returns
string[]

◆ getParameters()

static PFFormInput::getParameters ( )
static

Returns the set of parameters for this form input.

Returns
array[]

◆ getResourceModuleNames()

PFFormInput::getResourceModuleNames ( )

Returns the names of the resource modules this input type uses.

Returns the names of the modules as an array or - if there is only one module - as a string.

Returns
null|string|array

The documentation for this class was generated from the following file:

About | General disclaimer | Privacy policy