SubstitutionInterface.php 896 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Drupal\linkit;
  3. use Drupal\Component\Plugin\PluginInspectionInterface;
  4. use Drupal\Core\Entity\EntityInterface;
  5. use Drupal\Core\Entity\EntityTypeInterface;
  6. /**
  7. * Interface for substitution plugins.
  8. */
  9. interface SubstitutionInterface extends PluginInspectionInterface {
  10. /**
  11. * Get the URL associated with a given entity.
  12. *
  13. * @param \Drupal\Core\Entity\EntityInterface $entity
  14. * The entity to get a URL for.
  15. *
  16. * @return \Drupal\Core\GeneratedUrl
  17. * A url to replace.
  18. */
  19. public function getUrl(EntityInterface $entity);
  20. /**
  21. * Checks if this substitution plugin is applicable for the given entity type.
  22. *
  23. * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  24. * An entity type object.
  25. *
  26. * @return bool
  27. * If the plugin is applicable.
  28. */
  29. public static function isApplicable(EntityTypeInterface $entity_type);
  30. }