IconRendererBase.php in Icon API 8
File
src/Plugin/Icon/IconRendererBase.php
View source
<?php
namespace Drupal\icon\Plugin\Icon;
use Drupal\Core\Plugin\PluginBase;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class IconRendererBase extends PluginBase implements IconRendererInterface {
use ContainerAwareTrait;
public function __construct(array $configuration, $plugin_id, $plugin_definition, ContainerInterface $container = NULL) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
if (!isset($container)) {
$container = \Drupal::getContainer();
}
$this
->setContainer($container);
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container);
}
public function getLabel() {
return isset($this->pluginDefinition['label']) ? $this->pluginDefinition['label'] : $this
->getPluginId();
}
public function getFile() {
return isset($this->pluginDefinition['file']) ? $this->pluginDefinition['file'] : '';
}
public function getPath() {
return isset($this->pluginDefinition['path']) ? $this->pluginDefinition['path'] : '';
}
}