From 9da4a8f2eeba1d962e7e074583c5300a030b3fee Mon Sep 17 00:00:00 2001 From: argiepiano Date: Fri, 5 Apr 2024 18:52:04 -0600 Subject: [PATCH 1/4] Issue #173. Move the "comment" node property info to comment.info.inc --- modules/comment.info.inc | 7 ++++--- modules/node.info.inc | 9 --------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/modules/comment.info.inc b/modules/comment.info.inc index ed2e4bc..0f4d813 100644 --- a/modules/comment.info.inc +++ b/modules/comment.info.inc @@ -131,11 +131,12 @@ function entity_plus_metadata_comment_entity_property_info_alter(&$info) { // Add info about comment module related properties to the node entity. $properties = &$info['node']['properties']; $properties['comment'] = array( - 'label' => t("Comments allowed"), - 'description' => t("Whether comments are allowed on this node: 0 = no, 1 = closed (read only), 2 = open (read/write)."), + 'label' => t("Comments settings"), + 'description' => t("Whether comments are allowed on this node."), 'setter callback' => 'entity_plus_property_verbatim_set', - 'setter permission' => 'administer comments', + 'setter permission' => 'administer comment settings', 'type' => 'integer', + 'options list' => 'entity_plus_metadata_node_comment_settings_options_list', ); $properties['comments'] = array( 'label' => t("Comments"), diff --git a/modules/node.info.inc b/modules/node.info.inc index 2e7201f..2ef3b10 100644 --- a/modules/node.info.inc +++ b/modules/node.info.inc @@ -152,15 +152,6 @@ function entity_plus_metadata_node_entity_property_info() { 'setter callback' => 'entity_plus_property_verbatim_set', 'access callback' => 'entity_plus_metadata_node_revision_access', ); - $properties['comment'] = array( - 'label' => t('Comment settings'), - 'description' => t("Whether the comments are allowed on this node."), - 'type' => 'integer', - 'setter callback' => 'entity_plus_property_verbatim_set', - 'setter permission' => 'administer comment settings', - 'schema field' => 'comment', - 'options list' => 'entity_plus_metadata_node_comment_settings_options_list', - ); return $info; } From aff9acf521b28c708f840de608233d378b5c7087 Mon Sep 17 00:00:00 2001 From: argiepiano Date: Mon, 10 Jun 2024 14:14:33 -0600 Subject: [PATCH 2/4] Issue #175. Add 'disk storage' entity info key. --- entity_plus.api.php | 5 +++++ entity_plus.module | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/entity_plus.api.php b/entity_plus.api.php index 058dbf8..81ae634 100644 --- a/entity_plus.api.php +++ b/entity_plus.api.php @@ -229,6 +229,11 @@ * may use this value to decide whether they should deal with a certain entity * type. Defaults to TRUE to for entity types that are exportable, else to * FALSE. + * - disk storage: (optional) A boolean flag for configuration or exportable + * entities to indicate that this entity is stored on disk, instead of the + * database. It defaults to FALSE. NB: modules wishing to store entities on + * disk should override EntityPlusControllerExportable to handle all disk + * CRUD operations. * * @see entity_load() * @see hook_entity_info_alter() diff --git a/entity_plus.module b/entity_plus.module index 816f215..3e7b4fe 100644 --- a/entity_plus.module +++ b/entity_plus.module @@ -835,8 +835,8 @@ function _entity_plus_defaults_rebuild($entity_type) { ); // Check for the existence of the module and status columns. - if (!in_array($keys['status'], $info['schema_fields_sql']['base table']) || !in_array($keys['module'], $info['schema_fields_sql']['base table'])) { - trigger_error("Missing database columns for the exportable entity $entity_type as defined by entity_plus_exportable_schema_fields(). Update the according module and run update.php!", E_USER_WARNING); + if (empty($info['disk storage']) && !in_array($keys['status'], $info['schema_fields_sql']['base table']) || !in_array($keys['module'], $info['schema_fields_sql']['base table'])) { + trigger_error("Missing database status and module columns for the exportable entity $entity_type.", E_USER_WARNING); return; } From a8f97981396c3638f63eba96a42ef01d7b3ee91c Mon Sep 17 00:00:00 2001 From: argiepiano Date: Mon, 10 Jun 2024 15:11:44 -0600 Subject: [PATCH 3/4] Fix error in logic. --- entity_plus.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entity_plus.module b/entity_plus.module index 3e7b4fe..cfce8d6 100644 --- a/entity_plus.module +++ b/entity_plus.module @@ -835,7 +835,7 @@ function _entity_plus_defaults_rebuild($entity_type) { ); // Check for the existence of the module and status columns. - if (empty($info['disk storage']) && !in_array($keys['status'], $info['schema_fields_sql']['base table']) || !in_array($keys['module'], $info['schema_fields_sql']['base table'])) { + if (empty($info['disk storage']) && (!in_array($keys['status'], $info['schema_fields_sql']['base table']) || !in_array($keys['module'], $info['schema_fields_sql']['base table']))) { trigger_error("Missing database status and module columns for the exportable entity $entity_type.", E_USER_WARNING); return; } From fc4d5784a161daf92d21ed4cb3b69764d392a076 Mon Sep 17 00:00:00 2001 From: argiepiano Date: Mon, 10 Jun 2024 16:43:34 -0600 Subject: [PATCH 4/4] Changed key to cmi storage --- entity_plus.api.php | 10 +++++----- entity_plus.module | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/entity_plus.api.php b/entity_plus.api.php index 81ae634..d55dd85 100644 --- a/entity_plus.api.php +++ b/entity_plus.api.php @@ -229,11 +229,11 @@ * may use this value to decide whether they should deal with a certain entity * type. Defaults to TRUE to for entity types that are exportable, else to * FALSE. - * - disk storage: (optional) A boolean flag for configuration or exportable - * entities to indicate that this entity is stored on disk, instead of the - * database. It defaults to FALSE. NB: modules wishing to store entities on - * disk should override EntityPlusControllerExportable to handle all disk - * CRUD operations. + * - cmi storage: (optional) A boolean flag for configuration or exportable + * entities to indicate that this entity is stored as a Backdrop json CMI + * configuration, instead of on its own table in the database. It defaults + * to FALSE. NB: modules wishing to store entities as CMI should override + * EntityPlusControllerExportable to handle all CMI CRUD operations. * * @see entity_load() * @see hook_entity_info_alter() diff --git a/entity_plus.module b/entity_plus.module index cfce8d6..3612a5e 100644 --- a/entity_plus.module +++ b/entity_plus.module @@ -835,7 +835,7 @@ function _entity_plus_defaults_rebuild($entity_type) { ); // Check for the existence of the module and status columns. - if (empty($info['disk storage']) && (!in_array($keys['status'], $info['schema_fields_sql']['base table']) || !in_array($keys['module'], $info['schema_fields_sql']['base table']))) { + if (empty($info['cmi storage']) && (!in_array($keys['status'], $info['schema_fields_sql']['base table']) || !in_array($keys['module'], $info['schema_fields_sql']['base table']))) { trigger_error("Missing database status and module columns for the exportable entity $entity_type.", E_USER_WARNING); return; }