original_string: public function getCollectionItemAjax()
      {
          $term = $this->getPosted('term');
          $collection_id = $this->getPosted('collection_id');
  
          if (empty($term) || empty($collection_id)) {
              return array('error' => $this->text('An error occurred'));
          }
  
          $collection = $this->collection->get($collection_id);
  
          if (empty($collection)) {
              return array('error' => $this->text('An error occurred'));
          }
  
          if (!$this->access($collection['type'])) {
              return array('error' => $this->text('No access'));
          }
  
          $conditions = array(
              'status' => 1,
              'title' => $term,
              'store_id' => $collection['store_id'],
              'limit' => array(0, $this->config('autocomplete_limit', 10))
          );
  
          return $this->collection_item->getListEntities($collection['type'], $conditions);
      }
code: public function getCollectionItemAjax()
      {
          $term = $this->getPosted('term');
          $collection_id = $this->getPosted('collection_id');
  
          if (empty($term) || empty($collection_id)) {
              return array('error' => $this->text('An error occurred'));
          }
  
          $collection = $this->collection->get($collection_id);
  
          if (empty($collection)) {
              return array('error' => $this->text('An error occurred'));
          }
  
          if (!$this->access($collection['type'])) {
              return array('error' => $this->text('No access'));
          }
  
          $conditions = array(
              'status' => 1,
              'title' => $term,
              'store_id' => $collection['store_id'],
              'limit' => array(0, $this->config('autocomplete_limit', 10))
          );
  
          return $this->collection_item->getListEntities($collection['type'], $conditions);
      }
code_tokens: public function getCollectionItemAjax ( ) { $ term = $ this -> getPosted ( 'term' ) ; $ collection_id = $ this -> getPosted ( 'collection_id' ) ; if ( empty ( $ term ) || empty ( $ collection_id ) ) { return array ( 'error' => $ this -> text ( 'An error occurred' ) ) ; } $ collection = $ this -> collection -> get ( $ collection_id ) ; if ( empty ( $ collection ) ) { return array ( 'error' => $ this -> text ( 'An error occurred' ) ) ; } if ( ! $ this -> access ( $ collection [ 'type' ] ) ) { return array ( 'error' => $ this -> text ( 'No access' ) ) ; } $ conditions = array ( 'status' => 1 , 'title' => $ term , 'store_id' => $ collection [ 'store_id' ] , 'limit' => array ( 0 , $ this -> config ( 'autocomplete_limit' , 10 ) ) ) ; return $ this -> collection_item -> getListEntities ( $ collection [ 'type' ] , $ conditions ) ; }
docstring: Returns an array of suggested collection entities
  @return array
docstring_tokens: Returns an array of suggested collection entities