/** * Gets a list of themes associated with the site type of the current theme * * @param boolean $omit_current defaults to true, set to false if you want to include the current theme as well * @return array */ function get_site_type_themes($omit_current = true) { $current_theme = $this->get_current_theme(); //get site types $e = new entity($this->admin_page->site_id); $e->set_env('site', $this->admin_page->site_id); $site_types = $e->get_left_relationship('site_to_site_type'); if (empty($site_types)) { return array(); } $site_type_ids = array(); foreach ($site_types as $st) { $site_type_ids[] = $st->id(); } //get themeses $es = new entity_selector(); $es->add_type(id_of('theme_type')); $es->add_right_relationship($site_type_ids, relationship_id_of('site_type_to_theme')); if ($current_theme and $omit_current) { $es->add_relation('entity.id !=' . $current_theme->id()); } $es->set_order('entity.name ASC'); return $es->run_one(); }