function ExampleHamSandwich::order
Same name in other branches
- 3.x modules/plugin_type_example/src/Plugin/Sandwich/ExampleHamSandwich.php \Drupal\plugin_type_example\Plugin\Sandwich\ExampleHamSandwich::order()
- 8.x-1.x plugin_type_example/src/Plugin/Sandwich/ExampleHamSandwich.php \Drupal\plugin_type_example\Plugin\Sandwich\ExampleHamSandwich::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: Array of extras to include with this order.
Return value
string A description of the sandwich ordered.
Overrides SandwichBase::order
File
-
modules/
plugin_type_example/ src/ Plugin/ Sandwich/ ExampleHamSandwich.php, line 45
Class
- ExampleHamSandwich
- Provides a ham sandwich.
Namespace
Drupal\plugin_type_example\Plugin\SandwichCode
public function order(array $extras) {
$ingredients = [
'ham, mustard',
'rocket',
'sun-dried tomatoes',
];
$sandwich = array_merge($ingredients, $extras);
return 'You ordered an ' . implode(', ', $sandwich) . ' sandwich. Enjoy!';
}