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,
|
||||
]);
|
||||
|
||||
// $this->register_importer([
|
||||
// 'name' => 'Youtube (Experimental)',
|
||||
// 'description' => __('Import items from an Youtube URL', 'tainacan'),
|
||||
// 'slug' => 'youtube_importer',
|
||||
// 'class_name' => '\Tainacan\Importer\Youtube_Importer',
|
||||
// 'manual_collection' => true,
|
||||
// 'manual_mapping' => true,
|
||||
// ]);
|
||||
$this->register_importer([
|
||||
'name' => 'Youtube (Experimental)',
|
||||
'description' => __('Import items from an Youtube URL', 'tainacan'),
|
||||
'slug' => 'youtube_importer',
|
||||
'class_name' => '\Tainacan\Importer\Youtube_Importer',
|
||||
'manual_collection' => true,
|
||||
'manual_mapping' => true,
|
||||
]);
|
||||
|
||||
do_action('tainacan_register_importers');
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class Youtube_Importer extends Importer {
|
|||
];
|
||||
|
||||
/**
|
||||
* construct
|
||||
* constructor
|
||||
*/
|
||||
public function __construct($attributes = array()) {
|
||||
parent::__construct($attributes);
|
||||
|
@ -109,7 +109,7 @@ class Youtube_Importer extends Importer {
|
|||
break;
|
||||
|
||||
case 'url':
|
||||
$value = 'https://www.youtube.com/watch?v=' . $item->snippet->videoId;
|
||||
$value = 'https://www.youtube.com/watch?v=' . $item->contentDetails->videoId;
|
||||
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 ){
|
||||
$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
|
||||
*/
|
||||
private function get_list_items() {
|
||||
|
|
Loading…
Reference in New Issue