Blesta Source Documentation

Logic

Package options logic handler.

Attributes
#[AllowDynamicProperties]
Table of Contents

Properties

$disabled_option_ids
$container_selector
$defaults
$evaluations
$option_condition_sets
$service
$triggers

Methods

__construct()
addPackageOptionConditionSet() Adds a package option condition set to the current list
getJavascript() Creates JS for configurable option display logic
setOptionContainerSelector() Sets the selector for the element
setPackageOptionConditionSets() Replaces the current condition list with a list of package option condition sets
setService() Sets the given service as the basis for evaluating config options
validate() Validates a list of configurable option data given the current condition set evaluations
evaluateCondition() Evaluates a single condition against submitted values
getElementSelector() Gets the appropriate element selector for an option and value
recordDisabledOptions() Records options that are disabled due to unmet conditional logic
submittedValueCoveredByConditionSet() Check if this condition set applies to the "Option Value" that was submitted
Properties

$disabled_option_ids

public mixed $disabled_option_ids = []

$container_selector

private mixed $container_selector = 'html'

$defaults

private mixed $defaults = []

$evaluations

private mixed $evaluations = []

$option_condition_sets

private mixed $option_condition_sets = []

$service

private mixed $service = null

$triggers

private mixed $triggers = []
Methods

__construct()

public __construct() : mixed

addPackageOptionConditionSet()

Adds a package option condition set to the current list

public addPackageOptionConditionSet(stdClass $condition_set) : mixed
Parameters
$condition_set : stdClass

A package option condition set

Tags
see
PackageOptionConditionSets::get()

getJavascript()

Creates JS for configurable option display logic

public getJavascript([string $view_dir = null ]) : string
Parameters
$view_dir : string = null

The directory in which to to look for the partial_packageoption_js.pdt file

Return values
string

The JS script tag

setOptionContainerSelector()

Sets the selector for the element

public setOptionContainerSelector(string $container_selector) : mixed
Parameters
$container_selector : string

setPackageOptionConditionSets()

Replaces the current condition list with a list of package option condition sets

public setPackageOptionConditionSets(array<string|int, mixed> $condition_sets) : mixed
Parameters
$condition_sets : array<string|int, mixed>

A list of objects each representing a package option condition set

Tags
see
PackageOptionConditionSets::getAll()

setService()

Sets the given service as the basis for evaluating config options

public setService(stdClass $service) : mixed
Parameters
$service : stdClass

validate()

Validates a list of configurable option data given the current condition set evaluations

public validate(array<string|int, mixed> $vars) : mixed
Parameters
$vars : array<string|int, mixed>

A list of submitted configurable option data to validate

evaluateCondition()

Evaluates a single condition against submitted values

private evaluateCondition(stdClass $condition, array<string|int, mixed> $vars) : bool
Parameters
$condition : stdClass

The condition to evaluate

$vars : array<string|int, mixed>

The submitted values

Return values
bool

Whether the condition is met

getElementSelector()

Gets the appropriate element selector for an option and value

private getElementSelector(stdClass $option, int $value_id) : string
Parameters
$option : stdClass

The option for which to get a selector

$value_id : int

The value for which to get a selector

Return values
string

The element selector

recordDisabledOptions()

Records options that are disabled due to unmet conditional logic

private recordDisabledOptions(array<string|int, mixed> $unevaluated_conditional_options, array<string|int, mixed> $vars) : mixed

For dropdown/select and radio options, only considers the option disabled if ALL option values are conditional. For other field types, considers the option disabled if any of its enabling conditions are not met.

Parameters
$unevaluated_conditional_options : array<string|int, mixed>

Array of condition sets for options that weren't submitted

$vars : array<string|int, mixed>

The submitted form values to evaluate conditions against

submittedValueCoveredByConditionSet()

Check if this condition set applies to the "Option Value" that was submitted

private submittedValueCoveredByConditionSet(array<string|int, mixed> $vars, array<string|int, mixed> $condition_set) : bool
Parameters
$vars : array<string|int, mixed>

A list of submitted configurable options

$condition_set : array<string|int, mixed>

A condition set

Tags
see
PackageOptionConditionSets::get()
Return values
bool
Tags
subpackage

core.Util.PackageOptions

copyright

Copyright (c) 2023, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results