AttributeInterface.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * @file
  4. * Contains \Drupal\linkit\AttributeInterface.
  5. */
  6. namespace Drupal\linkit;
  7. use Drupal\Component\Plugin\ConfigurablePluginInterface;
  8. use Drupal\Component\Plugin\PluginInspectionInterface;
  9. /**
  10. * Defines the interface for attributes plugins.
  11. *
  12. * @see \Drupal\linkit\Annotation\Attribute
  13. * @see \Drupal\linkit\AttributeBase
  14. * @see \Drupal\linkit\AttributeManager
  15. * @see plugin_api
  16. */
  17. interface AttributeInterface extends PluginInspectionInterface, ConfigurablePluginInterface {
  18. /**
  19. * Returns the attribute label.
  20. *
  21. * @return string
  22. * The attribute label.
  23. */
  24. public function getLabel();
  25. /**
  26. * Returns the attribute description.
  27. *
  28. * @return string
  29. * The attribute description.
  30. */
  31. public function getDescription();
  32. /**
  33. * Returns the attribute html name. This is the name of the attribute
  34. * that will be inserted in the <code>&lt;a&gt;</code> tag.
  35. *
  36. * @return string
  37. * The attribute html name.
  38. */
  39. public function getHtmlName();
  40. /**
  41. * Returns the weight of the attribute.
  42. *
  43. * @return int|string
  44. * Either the integer weight of the attribute or an empty string.
  45. */
  46. public function getWeight();
  47. /**
  48. * Sets the weight for this attribute.
  49. *
  50. * @param int $weight
  51. * The weight for this attribute.
  52. *
  53. * @return $this
  54. */
  55. public function setWeight($weight);
  56. /**
  57. * The form element structure for this attribute to be used in the dialog.
  58. *
  59. * @param mixed $default_value
  60. * The default value for the element. Used when editing an attribute in the
  61. * dialog.
  62. *
  63. * @return array
  64. * The form element.
  65. */
  66. public function buildFormElement($default_value);
  67. }