sitepress = $sitepress; $this->wpml_cache = $wpml_cache; } /** * @param int $id * @param string $type * * @return WPML_Translation_Element */ public function create( $id, $type ) { $class_name = sprintf( 'WPML_%s_Element', ucfirst( $type ) ); if ( ! class_exists( $class_name ) ) { throw new InvalidArgumentException( 'Element type: ' . $type . ' does not exist.' ); } return new $class_name( $id, $this->sitepress, $this->wpml_cache ); } }