本文整理匯總了PHP中entity::set_env方法的典型用法代碼示例。如果您正苦於以下問題:PHP entity::set_env方法的具體用法?PHP entity::set_env怎麽用?PHP entity::set_env使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類entity
的用法示例。
在下文中一共展示了entity::set_env方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: entity
/**
* 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();
}