Automattic\WooCommerce\Internal\Admin\BlockTemplates

AbstractBlock::add_hide_conditionpublicWC 1.0

Add a hide condition to the block.

The hide 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.

Метод класса: AbstractBlock{}

Возвращает

null. Ничего (null).

Использование

$AbstractBlock = new AbstractBlock();
$AbstractBlock->add_hide_condition( $expression ): string;
$expression(строка) (обязательный)
An expression, which if true, will hide the block.

Код AbstractBlock::add_hide_condition() WC 10.4.0

public function add_hide_condition( string $expression ): string {
	$key = 'k' . $this->hide_conditions_counter;
	$this->hide_conditions_counter++;

	// Storing the expression in an array to allow for future expansion
	// (such as adding the plugin that added the condition).
	$this->hide_conditions[ $key ] = array(
		'expression' => $expression,
	);

	/**
	 * Action called after a hide condition is added to a block.
	 *
	 * @param BlockInterface $block The block.
	 *
	 * @since 8.4.0
	 */
	do_action( 'woocommerce_block_template_after_add_hide_condition', $this );

	return $key;
}