public function ExampleMeatballSandwich::order in Examples for Developers 3.x
Same name and namespace in other branches
- 8 plugin_type_example/src/Plugin/Sandwich/ExampleMeatballSandwich.php \Drupal\plugin_type_example\Plugin\Sandwich\ExampleMeatballSandwich::order()
Place an order for a sandwich.
This is just an example method on our plugin that we can call to get something back.
Parameters
array $extras: An array of extra ingredients to include with this sandwich.
Return value
string Description of the sandwich that was just ordered.
Overrides SandwichBase::order
File
- modules/
plugin_type_example/ src/ Plugin/ Sandwich/ ExampleMeatballSandwich.php, line 88
Class
- ExampleMeatballSandwich
- Provides a meatball sandwich.
Namespace
Drupal\plugin_type_example\Plugin\SandwichCode
public function order(array $extras) {
$ingredients = [
'meatballs',
'irresistible marinara sauce',
];
$sandwich = array_merge($ingredients, $extras);
return 'You ordered an ' . implode(', ', $sandwich) . ' sandwich. Enjoy!';
}