Skip to content

Instantly share code, notes, and snippets.

@splatio
Created January 26, 2014 13:32
Show Gist options
  • Save splatio/8632769 to your computer and use it in GitHub Desktop.
Save splatio/8632769 to your computer and use it in GitHub Desktop.
<?php
namespace Drupal\hardcopy\Plugin;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\hardcopy\HardcopyCssIncludeInterface;
use Drupal\Core\Page\HtmlPage;
use Drupal\hardcopy\LinkExtractor\LinkExtractorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
abstract class HardcopyFormatBase extends PluginBase implements HardcopyFormatInterface, ContainerFactoryPluginInterface {
protected $configFactory;
protected $hardcopyCssInclude;
protected $linkExtractor;
public function __construct(array $configuration, $plugin_id, array $plugin_definition, ConfigFactory $config_factory, HardcopyCssIncludeInterface $hardcopy_css_include, LinkExtractorInterface $link_extractor) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->configFactory = $config_factory;
$this->hardcopyCssInclude = $hardcopy_css_include;
$this->linkExtractor = $link_extractor;
$this->configuration += $this->defaultConfiguration();
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
return new static(
$configuration, $plugin_id, $plugin_definition,
$container->get('config.factory'),
$container->get('hardcopy.css_include'),
$container->get('hardcopy.link_extractor')
);
}
public function getLabel() {}
public function getDescription() {}
public function defaultConfiguration() {}
public function getConfiguration() {}
public function setConfiguration(array $configuration) {}
public function validateConfigurationForm(array &$form, array &$form_state) {}
public function setContent(array $content) {}
public function getResponse() {}
protected function buildContent() {}
protected function getOutput() {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment