Pull merge.
[yaffs-website] / web / core / modules / block_content / src / Entity / BlockContentType.php
1 <?php
2
3 namespace Drupal\block_content\Entity;
4
5 use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
6 use Drupal\block_content\BlockContentTypeInterface;
7
8 /**
9  * Defines the custom block type entity.
10  *
11  * @ConfigEntityType(
12  *   id = "block_content_type",
13  *   label = @Translation("Custom block type"),
14  *   label_collection = @Translation("Custom block types"),
15  *   label_singular = @Translation("custom block type"),
16  *   label_plural = @Translation("custom block types"),
17  *   label_count = @PluralTranslation(
18  *     singular = "@count custom block type",
19  *     plural = "@count custom block types",
20  *   ),
21  *   label_collection = @Translation("Custom block library"),
22  *   handlers = {
23  *     "form" = {
24  *       "default" = "Drupal\block_content\BlockContentTypeForm",
25  *       "add" = "Drupal\block_content\BlockContentTypeForm",
26  *       "edit" = "Drupal\block_content\BlockContentTypeForm",
27  *       "delete" = "Drupal\block_content\Form\BlockContentTypeDeleteForm"
28  *     },
29  *     "route_provider" = {
30  *       "html" = "Drupal\Core\Entity\Routing\AdminHtmlRouteProvider"
31  *     },
32  *     "list_builder" = "Drupal\block_content\BlockContentTypeListBuilder"
33  *   },
34  *   admin_permission = "administer blocks",
35  *   config_prefix = "type",
36  *   bundle_of = "block_content",
37  *   entity_keys = {
38  *     "id" = "id",
39  *     "label" = "label"
40  *   },
41  *   links = {
42  *     "delete-form" = "/admin/structure/block/block-content/manage/{block_content_type}/delete",
43  *     "edit-form" = "/admin/structure/block/block-content/manage/{block_content_type}",
44  *     "collection" = "/admin/structure/block/block-content/types",
45  *   },
46  *   config_export = {
47  *     "id",
48  *     "label",
49  *     "revision",
50  *     "description",
51  *   }
52  * )
53  */
54 class BlockContentType extends ConfigEntityBundleBase implements BlockContentTypeInterface {
55
56   /**
57    * The custom block type ID.
58    *
59    * @var string
60    */
61   protected $id;
62
63   /**
64    * The custom block type label.
65    *
66    * @var string
67    */
68   protected $label;
69
70   /**
71    * The default revision setting for custom blocks of this type.
72    *
73    * @var bool
74    */
75   protected $revision;
76
77   /**
78    * The description of the block type.
79    *
80    * @var string
81    */
82   protected $description;
83
84   /**
85    * {@inheritdoc}
86    */
87   public function getDescription() {
88     return $this->description;
89   }
90
91   /**
92    * {@inheritdoc}
93    */
94   public function shouldCreateNewRevision() {
95     return $this->revision;
96   }
97
98 }