Helpers for displaying a list of options.

package XenForo_Options

 Methods

Prepares to display a multi-choice option (checkbox) by manipulating the formatting params into the expected format.

prepareMultiChoiceOptions(string $fieldPrefix, array $preparedOption) : array
Static

They come out in [name] => selected format. This is manipulated to maintain a checkbox output that will keep them this way.

Parameters

$fieldPrefix

string

HTML form field prefix

$preparedOption

array

Prepared option info

Returns

arrayUpdated format params

Internal function to prepare and render a generic option template.

renderOptionTemplateInternal(string $template, \XenForo_View $view, string $fieldPrefix, array $preparedOption, boolean $canEdit, array $extra) : \XenForo_Template_Abstract
Static

Parameters

$template

string

Name of the template that should be rendered

$view

\XenForo_View

View object

$fieldPrefix

string

Prefix for the HTML form field name

$preparedOption

array

Prepared option info

$canEdit

boolean

True if an "edit" link should appear

$extra

array

Extra parameters to be passed to the option template

Returns

Renders a {@link XenForo_Model_Option::preparedOption() prepared option} in the standard way.

renderPreparedOptionHtml(\XenForo_View $view, array $preparedOption, boolean $canEdit, string $fieldPrefix) : \XenForo_Template_Abstract
Static

Note that this doesn't actually render the prepared template, but the next usage in a string context will.

Parameters

$view

\XenForo_View

View object that this is being called from.

$preparedOption

array

Prepared option info

$canEdit

boolean

True if the user should see an "edit" link with the option

$fieldPrefix

string

Prefix for the name of the field the options will be written into. Must be a-z0-9_ only.

Returns

\XenForo_Template_AbstractYet-to-be-rendered template

Renders a collection of options in the standard way.

renderPreparedOptionsHtml(\XenForo_View $view, array $preparedOptions, boolean $canEdit, string $fieldPrefix) : array
Static

See renderPreparedOptionHtml() for more specifics on the arguments.

Parameters

$preparedOptions

array

$canEdit

boolean

$fieldPrefix

string

Returns

arrayArray of XenForo_Template_Abstract objects

Renders a callback-based option.

_renderCallbackOptionHtml(\XenForo_View $view, string $fieldPrefix, array $preparedOption, boolean $canEdit) : \XenForo_Template_Abstract
Static

The callback is responsible for all processing and layout.

Parameters

$view

\XenForo_View

View object

$fieldPrefix

string

Prefix for the HTML form field name

$preparedOption

array

Prepared option info

$canEdit

boolean

True if an "edit" link should appear

Returns

Renders a check box option.

_renderCheckBoxOptionHtml(\XenForo_View $view, string $fieldPrefix, array $preparedOption, boolean $canEdit) : \XenForo_Template_Abstract
Static

Parameters

$view

\XenForo_View

View object

$fieldPrefix

string

Prefix for the HTML form field name

$preparedOption

array

Prepared option info

$canEdit

boolean

True if an "edit" link should appear

Returns

Renders HTML for an invalid option type.

_renderInvalidOptionHtml(\XenForo_View $view, array $preparedOption, boolean $canEdit) : \XenForo_Template_Abstract
Static

Legitimately, this should never happen. :)

Parameters

$view

\XenForo_View

View object

$preparedOption

array

Prepared option info

$canEdit

boolean

True if an "edit" link should appear

Returns

Renders a single on-off check box option.

_renderOnOffOptionHtml(\XenForo_View $view, string $fieldPrefix, array $preparedOption, boolean $canEdit) : \XenForo_Template_Abstract
Static

Parameters

$view

\XenForo_View

View object

$fieldPrefix

string

Prefix for the HTML form field name

$preparedOption

array

Prepared option info

$canEdit

boolean

True if an "edit" link should appear

Returns

Renders a radio option.

_renderRadioOptionHtml(\XenForo_View $view, string $fieldPrefix, array $preparedOption, boolean $canEdit) : \XenForo_Template_Abstract
Static

Parameters

$view

\XenForo_View

View object

$fieldPrefix

string

Prefix for the HTML form field name

$preparedOption

array

Prepared option info

$canEdit

boolean

True if an "edit" link should appear

Returns

Renders a select option.

_renderSelectOptionHtml(\XenForo_View $view, string $fieldPrefix, array $preparedOption, boolean $canEdit) : \XenForo_Template_Abstract
Static

Parameters

$view

\XenForo_View

View object

$fieldPrefix

string

Prefix for the HTML form field name

$preparedOption

array

Prepared option info

$canEdit

boolean

True if an "edit" link should appear

Returns

Renders a spin box option.

_renderSpinBoxOptionHtml(\XenForo_View $view, string $fieldPrefix, array $preparedOption, boolean $canEdit) : \XenForo_Template_Abstract
Static

Parameters

$view

\XenForo_View

View object

$fieldPrefix

string

Prefix for the HTML form field name

$preparedOption

array

Prepared option info

$canEdit

boolean

True if an "edit" link should appear

Returns

Renders a template-based option.

_renderTemplateOptionHtml(\XenForo_View $view, string $fieldPrefix, array $preparedOption, boolean $canEdit, array $extra) : \XenForo_Template_Abstract
Static

Parameters

$view

\XenForo_View

View object

$fieldPrefix

string

Prefix for the HTML form field name

$preparedOption

array

Prepared option info

$canEdit

boolean

True if an "edit" link should appear

$extra

array

Extra parameters to be passed to the option template

Returns

Renders a text box option.

_renderTextBoxOptionHtml(\XenForo_View $view, string $fieldPrefix, array $preparedOption, boolean $canEdit) : \XenForo_Template_Abstract
Static

Parameters

$view

\XenForo_View

View object

$fieldPrefix

string

Prefix for the HTML form field name

$preparedOption

array

Prepared option info

$canEdit

boolean

True if an "edit" link should appear

Returns

Replaces {xen:phrase x} references in a formatting params list for an option.

_replacePhrasedText(array $formatParams) : array
Static

Parameters

$formatParams

array

List of format params ([name] => label string)

Returns

arrayFormat params with phrases replaced

_replacePhrasedTextCallback()

_replacePhrasedTextCallback(array $match) 
Static

Parameters

$match

Private constructor.

__construct() 

Use statically.