Create Post/Tag/Remove module class and route

- Fix tag name parameter in single tag removal link in mod/photos
- Remove "/post" from backend routes as it was preventing sessions from working in this module. No existing module had a route starting with "/post".
This commit is contained in:
Hypolite Petovan 2022-11-01 23:42:20 -04:00
commit e0dc7a471e
5 changed files with 172 additions and 7 deletions

View file

@ -1250,15 +1250,17 @@ function photos_content(App $a)
if (!empty($link_item['id'])) {
// parse tags and add links
$tag_arr = [];
foreach (Tag::getByURIId($link_item['uri-id']) as $tag) {
$tag_arr[] = [
'name' => $tag['name'],
'removeurl' => '/tagrm/' . $link_item['id'] . '/' . bin2hex($tag['name'])
];
foreach (explode(',', Tag::getCSVByURIId($link_item['uri-id'])) as $tag_name) {
if ($tag_name) {
$tag_arr[] = [
'name' => BBCode::toPlaintext($tag_name),
'removeurl' => 'post/' . $link_item['id'] . '/tag/remove/' . bin2hex($tag_name) . '?return=' . urlencode(DI::args()->getCommand()),
];
}
}
$tags = ['title' => DI::l10n()->t('Tags: '), 'tags' => $tag_arr];
if ($cmd === 'edit') {
$tags['removeanyurl'] = 'tagrm/' . $link_item['id'];
$tags['removeanyurl'] = 'post/' . $link_item['id'] . '/tag/remove?return=' . urlencode(DI::args()->getCommand());
$tags['removetitle'] = DI::l10n()->t('[Select tags to remove]');
}
}