本文整理匯總了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;
}