コード例 #1
0
 /**
  * Overriding the query list filter method: Exposing only boxes.
  */
 protected function queryForListFilter(\SelectQuery $query)
 {
     parent::queryForListFilter($query);
     if ($this->objectType) {
         $query->condition('object_type', $this->objectType);
     }
     if (!empty($this->request['vsite'])) {
         $query->condition('id', $_GET['vsite']);
     }
     if (!empty($this->request['delta'])) {
         $query->condition('object_id', $this->request['delta']);
     }
 }
コード例 #2
0
 /**
  * Overrides RestfulDataProviderDbQuery::queryForListFilter().
  *
  * Display the group roles by the group ID.
  *
  * {@inheritdoc}
  */
 protected function queryForListFilter(\SelectQuery $query)
 {
     parent::queryForListFilter($query);
     $request = $this->getRequest();
     if (empty($request['vsite'])) {
         throw new \RestfulForbiddenException('You must specify a vsite ID.');
     }
     $wrapper = entity_metadata_wrapper('node', $request['vsite']);
     if ($wrapper->og_roles_permissions->value()) {
         // The group override OG's default roles and permission. we need to return
         // only roles for this group.
         $query->condition('gid', $request['vsite']);
     } else {
         // The group use the default roles and permission. We need to display only
         // roles matching to the group bundle those who not relate to any group.
         $query->condition('group_bundle', $wrapper->getBundle());
         $query->condition('gid', 0);
     }
 }