Automattic\WooCommerce\Blocks
CoreBreadcrumbsCompatibility::replace_breadcrumb_label_at_index
Replace a breadcrumb label at an index.
Method of the class: CoreBreadcrumbsCompatibility{}
No Hooks.
Returns
array. Modified breadcrumb items.
Usage
// private - for code of main (parent) class only $result = $this->replace_breadcrumb_label_at_index( $items, $index, $label );
- $items(array) (required)
- Array of breadcrumb items from Core.
- $index(int|string|null) (required)
- Breadcrumb item index.
- $label(string) (required)
- Replacement label.
CoreBreadcrumbsCompatibility::replace_breadcrumb_label_at_index() CoreBreadcrumbsCompatibility::replace breadcrumb label at index code WC 11.1.2
private function replace_breadcrumb_label_at_index( $items, $index, $label ) {
if ( null === $index || ! isset( $items[ $index ] ) ) {
return $items;
}
$items[ $index ]['label'] = $label;
return $items;
}