Automattic\WooCommerce\Internal\Admin\BlockTemplates
AbstractBlock::add_disable_condition
Add a disable condition to the block.
The disable condition is a JavaScript-like expression that will be evaluated on the client to determine if the block should be hidden. See @woocommerce/expression-evaluation for more details.
Method of the class: AbstractBlock{}
No Hooks.
Returns
null
. Nothing (null).
Usage
$AbstractBlock = new AbstractBlock(); $AbstractBlock->add_disable_condition( $expression ): string;
- $expression(string) (required)
- An expression, which if true, will disable the block.
AbstractBlock::add_disable_condition() AbstractBlock::add disable condition code WC 9.9.3
public function add_disable_condition( string $expression ): string { $key = 'k' . $this->disable_conditions_counter; $this->disable_conditions_counter++; // Storing the expression in an array to allow for future expansion // (such as adding the plugin that added the condition). $this->disable_conditions[ $key ] = array( 'expression' => $expression, ); return $key; }