mirror of
https://github.com/wallabag/wallabag.git
synced 2025-01-20 21:58:09 +00:00
Add Tags on Import
I fixed it! And it works for me. But: I am not too good with programming. So better check the code ;-)
This commit is contained in:
parent
5537bb3216
commit
3052cfb7ca
1 changed files with 13 additions and 1 deletions
|
@ -192,6 +192,7 @@ class Poche
|
|||
} else {
|
||||
Tools::redirect('?view=home&closewin=true');
|
||||
}
|
||||
return $last_id;
|
||||
break;
|
||||
case 'delete':
|
||||
$msg = 'delete link #' . $id;
|
||||
|
@ -625,7 +626,18 @@ class Poche
|
|||
$urlsInserted[] = $url; //add
|
||||
if (isset($record['tags']) && trim($record['tags'])) {
|
||||
|
||||
// @TODO: set tags
|
||||
$tags = explode(' ', $record['tags']);
|
||||
foreach($tags as $tag) {
|
||||
$entry_id = $id;
|
||||
$tag_id = $this->store->retrieveTagByValue($tag);
|
||||
if ($tag_id) {
|
||||
$this->store->setTagToEntry($tag_id['id'], $entry_id);
|
||||
} else {
|
||||
$this->store->createTag($tag);
|
||||
$tag_id = $this->store->retrieveTagByValue($tag);
|
||||
$this->store->setTagToEntry($tag_id['id'], $entry_id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue