Skip to content

Instantly share code, notes, and snippets.

@andypost
Created January 10, 2013 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andypost/4506374 to your computer and use it in GitHub Desktop.
Save andypost/4506374 to your computer and use it in GitHub Desktop.
Menu as config entity
diff --git a/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php
new file mode 100644
index 0000000..7e3ceb0
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Menu.php
@@ -0,0 +1,60 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\system\Plugin\Core\Entity\Menu.
+ */
+
+namespace Drupal\system\Plugin\Core\Entity;
+
+use Drupal\Core\Config\Entity\ConfigEntityBase;
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+
+/**
+ * Defines the Menu configuration entity class.
+ *
+ * @Plugin(
+ * id = "menu",
+ * label = @Translation("Menu"),
+ * module = "system",
+ * controller_class = "Drupal\Core\Config\Entity\ConfigStorageController",
+ * config_prefix = "menu.menu",
+ * entity_keys = {
+ * "id" = "id",
+ * "label" = "label",
+ * "uuid" = "uuid"
+ * }
+ * )
+ */
+class Menu extends ConfigEntityBase {
+
+ /**
+ * The menu machine name.
+ *
+ * @var string
+ */
+ public $id;
+
+ /**
+ * The menu UUID.
+ *
+ * @var string
+ */
+ public $uuid;
+
+ /**
+ * The human-readable name of the menu entity.
+ *
+ * @var string
+ */
+ public $label;
+
+ /**
+ * The menu description.
+ *
+ * @var string
+ */
+ public $description;
+
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment