本文整理汇总了PHP中SitePress::core_tm方法的典型用法代码示例。如果您正苦于以下问题:PHP SitePress::core_tm方法的具体用法?PHP SitePress::core_tm怎么用?PHP SitePress::core_tm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SitePress
的用法示例。
在下文中一共展示了SitePress::core_tm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_defaults
/**
* Conditionally set some default values for event related custom fields translation.
*
* @return bool `false` if defaults were already set, `true` otherwise.
*/
public function set_defaults()
{
// make this check again has the action is triggered many times in a request lifecycle
if ($this->has_set_defaults()) {
return false;
}
$fields = $this->get_default_copy_fields();
foreach ($fields as $field) {
$this->sitepress->core_tm()->settings['custom_fields_translation'][$field] = WPML_COPY_CUSTOM_FIELD;
}
// remove the method to avoid infinite loops
remove_action('icl_save_settings', array($this, 'set_defaults'));
// the Translation Management plugin might not be active on this
// installation, save this option only if Translation Management is active.
$translation_management = $this->sitepress->core_tm();
$tm_is_active = !empty($translation_management) && is_a($translation_management, 'TranslationManagement');
if ($tm_is_active) {
$translation_management->save_settings();
Tribe__Settings_Manager::set_option($this->defaults_option_name, true);
return true;
}
return false;
}