/** * Inherit access from parent term * * Go throught the hierarchical branch of terms and retrieve access from the * first parent term that has access defined. * * @param int $term_id * * @return array * * @access private */ private function inheritAccess($term_id) { $term = new aam_Control_Object_Term($this->getSubject(), $term_id); $access = $term->getOption(); if (isset($access['post']) && $access['post']) { $result = array('post' => $access['post']); $this->setInherited(true); } elseif (is_object($term->getTerm()) && $term->getTerm()->parent) { $result = $this->inheritAccess($term->getTerm()->parent); } else { $result = array(); } return $result; }
/** * * @param type $term_id * @return array */ private function inheritAccess($term_id) { $term = new aam_Control_Object_Term($this->getSubject(), $term_id); if ($term->getTerm()) { $access = $term->getOption(); if (empty($access) && $term->getTerm()->parent) { $this->inheritAccess($term->getTerm()->parent); } elseif (!empty($access)) { $access['inherited'] = true; } } else { $access = array(); } return $access; }