Allow setting URL slug through admin panel.

This commit is contained in:
2018-02-22 20:07:06 +01:00
parent c6c249787f
commit bcbb74a680
3 changed files with 15 additions and 4 deletions

View File

@@ -33,10 +33,11 @@ class EditAsset extends HTMLController
}
// Key info
if (isset($_POST['title'], $_POST['date_captured'], $_POST['priority']))
if (isset($_POST['title'], $_POST['slug'], $_POST['date_captured'], $_POST['priority']))
{
$date_captured = !empty($_POST['date_captured']) ? new DateTime($_POST['date_captured']) : null;
$asset->setKeyData(htmlentities($_POST['title']), $date_captured, intval($_POST['priority']));
$slug = strtr($_POST['slug'], [' ' => '-', '--' => '-', '&' => 'and', '=>' => '', "'" => "", ":"=> "", '\\' => '-']);
$asset->setKeyData(htmlentities($_POST['title']), $slug, $date_captured, intval($_POST['priority']));
}
// Handle tags