Drupal Node Gallery 无法设置相册
🏷️ Drupal
使用【Node Gallery
】模块实现了相册功能,不知道改了哪里之后编辑时相册下拉框中看不到任何相册,但是管理员用户是可以看到的。
开始以为是权限问题,但是没有看到对应的权限选项。
后来在官方的 Issues 里找到了同样的问题(Users editing images in their own gallery cannot select any gallery besides -none-)。
node_gallery_node_access_bypass.patch
的内容如下:
diff
diff --git a/sites/all/modules/node_gallery/plugins/entityreference/selection/NodeGallerySelectionHandler.class.php b/sites/all/modules/node_gallery/plugins/entityreference/selection/NodeGallerySelectionHandler.class.php
index a377dd8..ee3fe06 100755
--- a/sites/all/modules/node_gallery/plugins/entityreference/selection/NodeGallerySelectionHandler.class.php
+++ b/sites/all/modules/node_gallery/plugins/entityreference/selection/NodeGallerySelectionHandler.class.php
@@ -49,6 +49,7 @@ class NodeGallerySelectionHandler extends EntityReference_SelectionHandler_Gener
protected function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') {
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', $this->field['settings']['target_type']);
+ //->fieldCondition('field_status', 'value', 1);
// Get target bundles from relationship type.
$relationship_type = node_gallery_api_get_relationship_type(NULL, NULL, $this->field['settings']['handler_settings']['node_gallery_relationship_type']);
$this->field['settings']['handler_settings']['target_bundles'] = $relationship_type->gallery_types;
@@ -63,12 +64,14 @@ class NodeGallerySelectionHandler extends EntityReference_SelectionHandler_Gener
}
// Add a generic entity access tag to the query.
- $query->addTag($this->field['settings']['target_type'] . '_access');
+ //$query->addTag($this->field['settings']['target_type'] . '_access');
+ $query->addTag('DANGEROUS_ACCESS_CHECK_OPT_OUT');
$query->addMetaData('op', 'update');
$query->addTag('entityreference');
$query->addMetaData('field', $this->field);
$query->addMetaData('entityreference_selection_handler', $this);
-
+ //drupal_set_message($this->field['settings']['target_type'] . '_access');
+
// Add the sort option.
if (!empty($this->field['settings']['handler_settings']['sort'])) {
$sort_settings = $this->field['settings']['handler_settings']['sort'];