/** * After find callback * Set user_role_id to the guest user_role_id after find (instead of during save or beforeSave) * because we don't want to force a user_role_id to be set. We'd rather that null means it is * a menu available to, but not necessarily the one returned to everyone. * * @return array */ public function afterFind($results, $primary = false) { for ($i = 0; $i < count($results); $i++) { if ($results[$i][$this->alias]['user_role_id'] === null) { $results[$i][$this->alias]['user_role_id'] = __SYSTEM_GUESTS_USER_ROLE_ID; } } return parent::afterFind($results, $primary); }
/** * After Find callback * */ public function afterFind($results, $primary = false) { $results = $this->_templateContentResults($results); for ($i = 0; $i < count($results); ++$i) { if (!empty($results[$i]['Child'][0])) { $results[$i]['Webpage']['type'] = 'section'; } } return parent::afterFind($results, $primary); }