ACF_Location_Block::get_valuespublicACF 5.9.0

Returns an array of possible values for this rule type.

Method of the class: ACF_Location_Block{}

No Hooks.

Returns

Array.

Usage

$ACF_Location_Block = new ACF_Location_Block();
$ACF_Location_Block->get_values( $rule );
$rule(array) (required)
A location rule.

Changelog

Since 5.9.0 Introduced.

ACF_Location_Block::get_values() code ACF 6.8.8

public function get_values( $rule ) {
	$choices = array();

	// Append block types.
	$blocks = acf_get_block_types();
	if ( $blocks ) {
		$choices['all'] = __( 'All', 'acf' );
		foreach ( $blocks as $block ) {
			$choices[ $block['name'] ] = $block['title'];
		}
	} else {
		$choices[''] = __( 'No block types exist', 'acf' );
	}

	// Return choices.
	return $choices;
}