Automattic\WooCommerce\Internal\Admin\BlockTemplates
AbstractBlockTemplate::generate_block_id()
Generate a block ID based on a base.
Method of the class: AbstractBlockTemplate{}
No Hooks.
Return
String
.
Usage
$AbstractBlockTemplate = new AbstractBlockTemplate(); $AbstractBlockTemplate->generate_block_id( $id_base ): string;
- $id_base(string) (required)
- The base to use when generating an ID.
AbstractBlockTemplate::generate_block_id() AbstractBlockTemplate::generate block id code WC 9.3.3
public function generate_block_id( string $id_base ): string { $instance_count = 0; do { $instance_count++; $block_id = $id_base . '-' . $instance_count; } while ( isset( $this->block_cache[ $block_id ] ) ); return $block_id; }