Youtube Importer: fix errors and set importer visible
This commit is contained in:
parent
57f3f49478
commit
abc704f92d
|
@ -61,14 +61,14 @@ class Importer_Handler {
|
||||||
'manual_mapping' => false,
|
'manual_mapping' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// $this->register_importer([
|
$this->register_importer([
|
||||||
// 'name' => 'Youtube (Experimental)',
|
'name' => 'Youtube (Experimental)',
|
||||||
// 'description' => __('Import items from an Youtube URL', 'tainacan'),
|
'description' => __('Import items from an Youtube URL', 'tainacan'),
|
||||||
// 'slug' => 'youtube_importer',
|
'slug' => 'youtube_importer',
|
||||||
// 'class_name' => '\Tainacan\Importer\Youtube_Importer',
|
'class_name' => '\Tainacan\Importer\Youtube_Importer',
|
||||||
// 'manual_collection' => true,
|
'manual_collection' => true,
|
||||||
// 'manual_mapping' => true,
|
'manual_mapping' => true,
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
do_action('tainacan_register_importers');
|
do_action('tainacan_register_importers');
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Youtube_Importer extends Importer {
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* construct
|
* constructor
|
||||||
*/
|
*/
|
||||||
public function __construct($attributes = array()) {
|
public function __construct($attributes = array()) {
|
||||||
parent::__construct($attributes);
|
parent::__construct($attributes);
|
||||||
|
@ -109,7 +109,7 @@ class Youtube_Importer extends Importer {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
$value = 'https://www.youtube.com/watch?v=' . $item->snippet->videoId;
|
$value = 'https://www.youtube.com/watch?v=' . $item->contentDetails->videoId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,10 @@ class Youtube_Importer extends Importer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* identify the type of url is send by user
|
* method responsible for identify the type of url
|
||||||
|
*
|
||||||
|
* @param bool $showDetails
|
||||||
|
* @return array|bool
|
||||||
*/
|
*/
|
||||||
public function identify_url( $showDetails = false ){
|
public function identify_url( $showDetails = false ){
|
||||||
$url = $this->get_url();
|
$url = $this->get_url();
|
||||||
|
@ -212,6 +215,8 @@ class Youtube_Importer extends Importer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* return the list of items for the different types of url
|
||||||
|
*
|
||||||
* @return array|mixed
|
* @return array|mixed
|
||||||
*/
|
*/
|
||||||
private function get_list_items() {
|
private function get_list_items() {
|
||||||
|
|
Loading…
Reference in New Issue