Ejemplo n.º 1
0
 /**
  * Get current entity identifiers collection by navigation identifier.
  *
  * @param QueryInterface $query Database query
  * @param string         $navigationID Navigation identifier
  * @param array          $return Variable where request result would be returned
  * @param array          $materialIDs Collection of material identifiers for filtering query
  *
  * @return bool|array True if field entities has been found and $return is passed
  *                      or collection of identifiers if only two parameters is passed.
  */
 public static function idsByNavigationID(QueryInterface $query, $navigationID, &$return = array(), $materialIDs = null)
 {
     // Prepare query
     $query->entity(CMS::FIELD_NAVIGATION_RELATION_ENTITY)->where('StructureID', $navigationID)->where('Active', 1);
     // Add material identifier filter if passed
     if (isset($materialIDs)) {
         $query->where('MaterialID', $materialIDs);
     }
     // Perform database query and get only material identifiers collection
     $return = $query->fields('FieldID');
     // If only one argument is passed - return null, otherwise bool
     return func_num_args() > 2 ? sizeof($return) : $return;
 }