Automattic\WooCommerce\Blocks\Assets
Api::get_block_metadata_path()
Get the path to a block's metadata
Метод класса: Api{}
Хуков нет.
Возвращает
Строку|true|false
. False if metadata file is not found for the block.
Использование
$Api = new Api(); $Api->get_block_metadata_path( $block_name, $path );
- $block_name(строка) (обязательный)
- The block to get metadata for.
- $path(строка)
- The path to the metadata file inside the 'assets/client/blocks' folder.
По умолчанию: ''
Код Api::get_block_metadata_path() Api::get block metadata path WC 9.3.3
public function get_block_metadata_path( $block_name, $path = '' ) { $path_to_metadata_from_plugin_root = $this->package->get_path( 'assets/client/blocks/' . $path . $block_name . '/block.json' ); if ( ! file_exists( $path_to_metadata_from_plugin_root ) ) { return false; } return $path_to_metadata_from_plugin_root; }