DependentPluginInterface.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Drupal\Component\Plugin;
  3. /**
  4. * Provides an interface for a plugin that has dependencies.
  5. *
  6. * @ingroup plugin_api
  7. */
  8. interface DependentPluginInterface {
  9. /**
  10. * Calculates dependencies for the configured plugin.
  11. *
  12. * Dependencies are saved in the plugin's configuration entity and are used to
  13. * determine configuration synchronization order. For example, if the plugin
  14. * integrates with specific user roles, this method should return an array of
  15. * dependencies listing the specified roles.
  16. *
  17. * @return array
  18. * An array of dependencies grouped by type (config, content, module,
  19. * theme). For example:
  20. * @code
  21. * array(
  22. * 'config' => array('user.role.anonymous', 'user.role.authenticated'),
  23. * 'content' => array('node:article:f0a189e6-55fb-47fb-8005-5bef81c44d6d'),
  24. * 'module' => array('node', 'user'),
  25. * 'theme' => array('seven'),
  26. * );
  27. * @endcode
  28. *
  29. * @see \Drupal\Core\Config\Entity\ConfigDependencyManager
  30. * @see \Drupal\Core\Entity\EntityInterface::getConfigDependencyName()
  31. */
  32. public function calculateDependencies();
  33. }