Fruit.php in Plug 7
Namespace
Drupal\plug_example\Plugin\fruitFile
modules/plug_example/src/Plugin/fruit/Fruit.phpView source
<?php
/**
* @file
* Contains Drupal\plug_example\Plugin\fruit\Fruit
*/
namespace Drupal\plug_example\Plugin\fruit;
use Drupal\Component\Plugin\PluginBase;
class Fruit extends PluginBase implements FruitInterface {
/**
* {@inheritdoc}
*/
public function display() {
$definition = $this
->getPluginDefinition();
if (!empty($definition['slimy'])) {
return t('Yikes, %name!', array(
'%name' => $definition['label'],
));
}
return t('Fruit name: %name', array(
'%name' => $definition['label'],
));
}
}