/** * Set up the relationship parser's tree and data pre-caching. * * The returned object will be passed to replace() as a third parameter. * * @param String The tagdata to be parsed * @param Object The preparser object. * @return Array The relationship parser object */ public function pre_process($tagdata, EE_Channel_preparser $pre) { if (empty($pre->channel()->rfields)) { return NULL; } ee()->load->library('relationships_parser'); try { return ee()->relationships_parser->create($pre->channel()->rfields, $pre->entry_ids()); } catch (EE_Relationship_exception $e) { ee()->TMPL->log_item($e->getMessage()); } return NULL; }
/** * Set up the relationship parser's tree and data pre-caching. * * The returned object will be passed to replace() as a third parameter. * * @param String The tagdata to be parsed * @param Object The preparser object. * @return Array The relationship parser object */ public function pre_process($tagdata, EE_Channel_preparser $pre) { $rfields = $pre->channel()->rfields; $process_fields = array(); foreach ($pre->site_ids() as $site_id) { if (!isset($rfields[$site_id]) or empty($rfields[$site_id])) { continue; } $process_fields[$site_id] = $rfields[$site_id]; } if (empty($process_fields)) { return NULL; } ee()->load->library('relationships_parser'); try { return ee()->relationships_parser->create($process_fields, $pre->entry_ids()); } catch (EE_Relationship_exception $e) { ee()->TMPL->log_item($e->getMessage()); } return NULL; }