added patch to repos
This commit is contained in:
		
							
								
								
									
										73
									
								
								0001-repatched-entityrefeerence-module.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								0001-repatched-entityrefeerence-module.patch
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
			
		||||
From 1f82c4ef9b474a12d160813f767128d645f524cc Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Bachir Soussi Chiadmi <bachir@g-u-i.me>
 | 
			
		||||
Date: Sun, 19 Apr 2015 21:04:36 +0200
 | 
			
		||||
Subject: [PATCH] repatched entityrefeerence module
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 ...ityReference_SelectionHandler_Generic.class.php | 43 +++++++++++++++++++---
 | 
			
		||||
 1 file changed, 38 insertions(+), 5 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/sites/all/modules/contrib/fields/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php b/sites/all/modules/contrib/fields/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
 | 
			
		||||
index 444a74c..660fe3d 100644
 | 
			
		||||
--- a/sites/all/modules/contrib/fields/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
 | 
			
		||||
+++ b/sites/all/modules/contrib/fields/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
 | 
			
		||||
@@ -370,6 +370,28 @@ class EntityReference_SelectionHandler_Generic_node extends EntityReference_Sele
 | 
			
		||||
  * This only exists to workaround core bugs.
 | 
			
		||||
  */
 | 
			
		||||
 class EntityReference_SelectionHandler_Generic_user extends EntityReference_SelectionHandler_Generic {
 | 
			
		||||
+
 | 
			
		||||
+  /**
 | 
			
		||||
+   * Implements EntityReferenceHandler::settingsForm().
 | 
			
		||||
+   */
 | 
			
		||||
+  public static function settingsForm($field, $instance) {
 | 
			
		||||
+    $settings = $field['settings']['handler_settings'];
 | 
			
		||||
+    $form = parent::settingsForm($field, $instance);
 | 
			
		||||
+    $form['referenceable_roles'] = array(
 | 
			
		||||
+      '#type' => 'checkboxes',
 | 
			
		||||
+      '#title' => t('User roles that can be referenced'),
 | 
			
		||||
+      '#default_value' => isset($settings['referenceable_roles']) ? array_filter($settings['referenceable_roles']) : array(),
 | 
			
		||||
+      '#options' => user_roles(TRUE),
 | 
			
		||||
+    );
 | 
			
		||||
+    $form['referenceable_status'] = array(
 | 
			
		||||
+      '#type' => 'checkboxes',
 | 
			
		||||
+      '#title' => t('User status that can be referenced'),
 | 
			
		||||
+      '#default_value' => isset($settings['referenceable_status']) ? array_filter($settings['referenceable_status']) : array('active' => 'active'),
 | 
			
		||||
+      '#options' => array('active' => t('Active'), 'blocked' => t('Blocked')),
 | 
			
		||||
+    );
 | 
			
		||||
+    return $form;
 | 
			
		||||
+  }
 | 
			
		||||
+
 | 
			
		||||
   public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') {
 | 
			
		||||
     $query = parent::buildEntityFieldQuery($match, $match_operator);
 | 
			
		||||
 
 | 
			
		||||
@@ -378,11 +400,22 @@ class EntityReference_SelectionHandler_Generic_user extends EntityReference_Sele
 | 
			
		||||
       $query->propertyCondition('name', $match, $match_operator);
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
-    // Adding the 'user_access' tag is sadly insufficient for users: core
 | 
			
		||||
-    // requires us to also know about the concept of 'blocked' and
 | 
			
		||||
-    // 'active'.
 | 
			
		||||
-    if (!user_access('administer users')) {
 | 
			
		||||
-      $query->propertyCondition('status', 1);
 | 
			
		||||
+    $field = $this->field;
 | 
			
		||||
+    $settings = $field['settings']['handler_settings'];
 | 
			
		||||
+    $referenceable_roles = isset($settings['referenceable_roles']) ? array_filter($settings['referenceable_roles']) : array();
 | 
			
		||||
+    $referenceable_status = isset($settings['referenceable_status']) ? array_filter($settings['referenceable_status']) : array('active' => 'active');
 | 
			
		||||
+
 | 
			
		||||
+    // If this filter is not filled, use the users access permissions.
 | 
			
		||||
+    if (empty($referenceable_status)) {
 | 
			
		||||
+      // Adding the 'user_access' tag is sadly insufficient for users: core
 | 
			
		||||
+      // requires us to also know about the concept of 'blocked' and 'active'.
 | 
			
		||||
+      if (!user_access('administer users')) {
 | 
			
		||||
+        $query->propertyCondition('status', 1);
 | 
			
		||||
+      }
 | 
			
		||||
+    }
 | 
			
		||||
+    elseif (count($referenceable_status) == 1) {
 | 
			
		||||
+      $values = array('active' => 1, 'blocked' => 0);
 | 
			
		||||
+      $query->propertyCondition('status', $values[key($referenceable_status)]);
 | 
			
		||||
     }
 | 
			
		||||
     return $query;
 | 
			
		||||
   }
 | 
			
		||||
-- 
 | 
			
		||||
2.3.5
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user