BlogType.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace Drupal\dr8_zth\Entity;
  3. use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
  4. use Drupal\dr8_zth\BlogTypeInterface;
  5. /**
  6. * Defines the taxonomy vocabulary entity.
  7. *
  8. * @ConfigEntityType(
  9. * id = "blog_type",
  10. * label = @Translation("Blog type"),
  11. * handlers = {
  12. * "form" = {
  13. * "default" = "Drupal\dr8_zth\Form\BlogTypeForm",
  14. * "delete" = "Drupal\dr8_zth\Form\BlogTypeDeleteForm"
  15. * },
  16. * "list_builder" = "Drupal\dr8_zth\BlogTypeListBuilder",
  17. * },
  18. * admin_permission = "administer blog",
  19. * config_prefix = "type",
  20. * bundle_of = "blog",
  21. * entity_keys = {
  22. * "id" = "type",
  23. * "label" = "name",
  24. * },
  25. * links = {
  26. * "add-form" = "/admin/structure/blog/manage/{blog_type}/add",
  27. * "collection" = "/admin/structure/blog",
  28. * "delete-form" = "/admin/structure/blog/manage/{blog_type}/delete",
  29. * "edit-form" = "/admin/structure/blog/manage/{blog_type}"
  30. * },
  31. * config_export = {
  32. * "name",
  33. * "type",
  34. * "description",
  35. * }
  36. * )
  37. */
  38. class BlogType extends ConfigEntityBundleBase implements BlogTypeInterface {
  39. /**
  40. * The blog type description.
  41. *
  42. * @var string
  43. */
  44. protected $description;
  45. /**
  46. * The label entity_key.
  47. *
  48. * @var string
  49. */
  50. protected $name;
  51. /**
  52. * The id entity_key.
  53. *
  54. * @var string
  55. */
  56. protected $type;
  57. /**
  58. * {@inheritdoc}
  59. */
  60. public function id() {
  61. return $this->type;
  62. }
  63. /**
  64. * {@inheritdoc}
  65. */
  66. public function getDescription() {
  67. return $this->description;
  68. }
  69. /**
  70. * {@inheritdoc}
  71. */
  72. public function setDescription($description) {
  73. $this->description = $description;
  74. return $this;
  75. }
  76. }