protected function AddToCart::filterPreparedAttributedByElementType in Commerce Cart Flyout 8
Filters prepared attributes by element type.
Parameters
array $prepared_attributes: The prepared attributes.
string $element_type: The element type to filter on.
Return value
array An array of filter prepared attributes.
1 call to AddToCart::filterPreparedAttributedByElementType()
- AddToCart::renderPreparedAttributes in src/
Plugin/ Field/ FieldFormatter/ AddToCart.php - Renders the prepared attributes.
File
- src/
Plugin/ Field/ FieldFormatter/ AddToCart.php, line 278
Class
- AddToCart
- Plugin implementation of the 'commerce_cart_flyout_add_to_cart' formatter.
Namespace
Drupal\commerce_cart_flyout\Plugin\Field\FieldFormatterCode
protected function filterPreparedAttributedByElementType(array $prepared_attributes, $element_type) {
return array_filter($prepared_attributes, function (PreparedAttribute $attribute) use ($element_type) {
return $attribute
->getElementType() == $element_type;
});
}