You are here

public function SandwichBase::calories in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/plugin_type_example/src/SandwichBase.php \Drupal\plugin_type_example\SandwichBase::calories()

Provide the number of calories per serving for the sandwich.

Return value

float The number of calories per serving.

Overrides SandwichInterface::calories

File

plugin_type_example/src/SandwichBase.php, line 43

Class

SandwichBase
A base class to help developers implement their own sandwich plugins.

Namespace

Drupal\plugin_type_example

Code

public function calories() {

  // Retrieve the @calories property from the annotation and return it.
  return (double) $this->pluginDefinition['calories'];
}