/**
  * @param int      $event_id
  * @param int|null $parent_event_id
  *
  * @return mixed
  */
 public function handle($event_id, $parent_event_id = null)
 {
     $language_code = $this->wpml->get_parent_language_code($parent_event_id);
     if (empty($language_code)) {
         return -1;
     }
     $trid = $this->wpml->get_master_series_instance_trid($event_id, $parent_event_id);
     return $this->wpml->insert_event_translation_for_language_code($event_id, $language_code, $trid, true);
 }
Example #2
0
 /**
  * The class singleton constructor.
  *
  * @return Tribe__Events__Pro__Integrations__WPML__WPML
  */
 public static function instance()
 {
     if (empty(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #3
0
 /**
  * Loads WPML integration classes and event listeners.
  *
  * @return bool
  */
 private function load_wpml_integration()
 {
     if (!(class_exists('SitePress') && defined('ICL_PLUGIN_PATH'))) {
         return false;
     }
     Tribe__Events__Pro__Integrations__WPML__WPML::instance()->hook();
     return true;
 }