I'm extending the Channel module entries() method in my custom plugin and am trying to figure out how to include the search: parameter. I get that the search parameters are an array accessed via ee()->TMPL->search_fields, but I can't figure out how to pass that data to the method. Here's what I have (simplified):

public function entries()
    $channel = ee()->TMPL->fetch_param('channel');
    $search_fields = ee()->TMPL->search_fields;

    return $this->_channel_entries($channel, $search_fields);

private function _channel_entries( $channel='', $search_fields=array() )
    ee()->TMPL->tagparams = array(
        'channel' = $channel,
        'disable' = 'member_data|pagination|categories'

    ee()->TMPL->search_fields = $search_fields;

    if (! class_exists('channel'))
      require_once PATH_MOD.'channel/mod.channel.php';

  $channel = new Channel;

  return $channel->entries();

How do I give the entries() method access to the search_fields data?

1 Answer 1


If those methods are in your own plugin/module, then the search:foo parameters won't be added to the search_fields property. That only happens for the channel:entries tag. For any other tag, those parameters are present in the ee()->TMPL->tagparams array. So, to pass them on to the native Channel::entries(), read the param from the tagparams array, strip the search: prefix from the key, and set the search_fields array before calling the entries method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.