/** * Returns the capability-restrictions array (@see EEM_Base::_cap_restrictions). * * If $context is provided (which should be set to one of EEM_Base::valid_cap_contexts()) * only returns the cap restrictions array in that context (ie, the array * at that key) * @param string $context * @return EE_Default_Where_Conditions[] indexed by associated capability */ public function cap_restrictions($context = EEM_Base::caps_read) { EEM_Base::verify_is_valid_cap_context($context); //check if we ought to run the restriction generator first if (isset($this->_cap_restriction_generators[$context]) && $this->_cap_restriction_generators[$context] instanceof EE_Restriction_Generator_Base && !$this->_cap_restriction_generators[$context]->has_generated_cap_restrictions()) { $this->_cap_restrictions[$context] = array_merge($this->_cap_restrictions[$context], $this->_cap_restriction_generators[$context]->generate_restrictions()); } //and make sure we've finalized the construction of each restriction foreach ($this->_cap_restrictions[$context] as $where_conditions_obj) { $where_conditions_obj->_finalize_construct($this); } return $this->_cap_restrictions[$context]; }