Skip to content

Instantly share code, notes, and snippets.

@dsnopek
Created January 12, 2016 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsnopek/611cea4581b2b4d25156 to your computer and use it in GitHub Desktop.
Save dsnopek/611cea4581b2b4d25156 to your computer and use it in GitHub Desktop.
/**
* A Panels storage service that stores Panels displays in Page Manager.
*
* @PanelsStorage(
* id = "page_manager"
* )
*/
class PageManagerPanelsStorage implements PanelsStorageInterface, ContainerFactoryPluginInterface {
/**
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a PageManagerPanelsStorage.
*
* @param array $configuration
* @param string $plugin_id
* @param mixed $plugin_definition
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('entity_type.manager')
);
}
// ... etc ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment