5 * Provides info about the node entity.
9 * Implements hook_entity_property_info() on top of node module.
11 * @see entity_entity_property_info()
13 function entity_metadata_node_entity_property_info() {
15 // Add meta-data about the basic node properties.
16 $properties = &$info['node']['properties'];
18 $properties['nid'] = array(
19 'label' => t("Node ID"),
21 'description' => t("The unique ID of the node."),
22 'schema field' => 'nid',
24 $properties['vid'] = array(
25 'label' => t("Revision ID"),
27 'description' => t("The unique ID of the node's revision."),
28 'schema field' => 'vid',
30 $properties['is_new'] = array(
31 'label' => t("Is new"),
33 'description' => t("Whether the node is new and not saved to the database yet."),
34 'getter callback' => 'entity_metadata_node_get_properties',
36 $properties['type'] = array(
37 'label' => t("Content type"),
39 'description' => t("The type of the node."),
40 'setter callback' => 'entity_property_verbatim_set',
41 'setter permission' => 'administer nodes',
42 'options list' => 'node_type_get_names',
44 'schema field' => 'type',
46 $properties['title'] = array(
47 'label' => t("Title"),
48 'description' => t("The title of the node."),
49 'setter callback' => 'entity_property_verbatim_set',
50 'schema field' => 'title',
53 $properties['language'] = array(
54 'label' => t("Language"),
56 'description' => t("The language the node is written in."),
57 'setter callback' => 'entity_property_verbatim_set',
58 'options list' => 'entity_metadata_language_list',
59 'schema field' => 'language',
60 'setter permission' => 'administer nodes',
62 $properties['url'] = array(
64 'description' => t("The URL of the node."),
65 'getter callback' => 'entity_metadata_entity_get_properties',
69 $properties['edit_url'] = array(
70 'label' => t("Edit URL"),
71 'description' => t("The URL of the node's edit page."),
72 'getter callback' => 'entity_metadata_node_get_properties',
76 $properties['status'] = array(
77 'label' => t("Status"),
78 'description' => t("Whether the node is published or unpublished."),
79 // Although the status is expected to be boolean, its schema suggests
80 // it is an integer, so we follow the schema definition.
82 'options list' => 'entity_metadata_status_options_list',
83 'setter callback' => 'entity_property_verbatim_set',
84 'setter permission' => 'administer nodes',
85 'schema field' => 'status',
87 $properties['promote'] = array(
88 'label' => t("Promoted to frontpage"),
89 'description' => t("Whether the node is promoted to the frontpage."),
90 'setter callback' => 'entity_property_verbatim_set',
91 'setter permission' => 'administer nodes',
92 'schema field' => 'promote',
95 $properties['sticky'] = array(
96 'label' => t("Sticky in lists"),
97 'description' => t("Whether the node is displayed at the top of lists in which it appears."),
98 'setter callback' => 'entity_property_verbatim_set',
99 'setter permission' => 'administer nodes',
100 'schema field' => 'sticky',
103 $properties['created'] = array(
104 'label' => t("Date created"),
106 'description' => t("The date the node was posted."),
107 'setter callback' => 'entity_property_verbatim_set',
108 'setter permission' => 'administer nodes',
109 'schema field' => 'created',
111 $properties['changed'] = array(
112 'label' => t("Date changed"),
114 'schema field' => 'changed',
115 'description' => t("The date the node was most recently updated."),
117 $properties['author'] = array(
118 'label' => t("Author"),
120 'description' => t("The author of the node."),
121 'setter callback' => 'entity_property_verbatim_set',
122 'setter permission' => 'administer nodes',
124 'schema field' => 'uid',
126 $properties['source'] = array(
127 'label' => t("Translation source node"),
129 'description' => t("The original-language version of this node, if one exists."),
130 'getter callback' => 'entity_metadata_node_get_properties',
132 $properties['log'] = array(
133 'label' => t("Revision log message"),
135 'description' => t("In case a new revision is to be saved, the log entry explaining the changes for this version."),
136 'setter callback' => 'entity_property_verbatim_set',
137 'access callback' => 'entity_metadata_node_revision_access',
139 $properties['revision'] = array(
140 'label' => t("Creates revision"),
142 'description' => t("Whether saving this node creates a new revision."),
143 'setter callback' => 'entity_property_verbatim_set',
144 'access callback' => 'entity_metadata_node_revision_access',
150 * Implements hook_entity_property_info_alter() on top of node module.
151 * @see entity_metadata_entity_property_info_alter()
153 function entity_metadata_node_entity_property_info_alter(&$info) {
154 // Move the body property to the node by default, as its usually there this
155 // makes dealing with it more convenient.
156 $info['node']['properties']['body'] = array(
157 'type' => 'text_formatted',
158 'label' => t('The main body text'),
159 'getter callback' => 'entity_metadata_field_verbatim_get',
160 'setter callback' => 'entity_metadata_field_verbatim_set',
161 'property info' => entity_property_text_formatted_info(),
162 'auto creation' => 'entity_property_create_array',