diff --git a/Admin/Install/db.json b/Admin/Install/db.json index b02b3a6..99ce29a 100644 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -42,6 +42,11 @@ "type": "VARCHAR(255)", "null": false }, + "media_virtual": { + "name": "media_virtual", + "type": "VARCHAR(255)", + "null": false + }, "media_absolute": { "name": "media_absolute", "type": "TINYINT", diff --git a/Models/Media.php b/Models/Media.php index de8942f..231d60a 100644 --- a/Models/Media.php +++ b/Models/Media.php @@ -81,6 +81,14 @@ class Media implements \JsonSerializable */ protected $path = ''; + /** + * Virtual path. + * + * @var string + * @since 1.0.0 + */ + protected $virtualPath = '/'; + /** * Is path absolute? * @@ -186,6 +194,16 @@ class Media implements \JsonSerializable return $this->path; } + /** + * @return string + * + * @since 1.0.0 + */ + public function getVirtualPath() : string + { + return $this->virtualPath; + } + /** * @return string * @@ -272,6 +290,18 @@ class Media implements \JsonSerializable $this->path = \str_replace('\\', '/', $path); } + /** + * @param string $path $filepath + * + * @return void + * + * @since 1.0.0 + */ + public function setVirtualPath(string $path) : void + { + $this->virtualPath = \str_replace('\\', '/', $path); + } + /** * @param string $name Media name (not file name) * diff --git a/Models/MediaMapper.php b/Models/MediaMapper.php index 7951237..56866b5 100644 --- a/Models/MediaMapper.php +++ b/Models/MediaMapper.php @@ -42,6 +42,7 @@ class MediaMapper extends DataMapperAbstract 'media_description_raw' => ['name' => 'media_description_raw', 'type' => 'string', 'internal' => 'descriptionRaw'], 'media_versioned' => ['name' => 'media_versioned', 'type' => 'bool', 'internal' => 'versioned'], 'media_file' => ['name' => 'media_file', 'type' => 'string', 'internal' => 'path', 'autocomplete' => true], + 'media_virtual' => ['name' => 'media_virtual', 'type' => 'string', 'internal' => 'virtualPath', 'autocomplete' => true], 'media_absolute' => ['name' => 'media_absolute', 'type' => 'bool', 'internal' => 'isAbsolute'], 'media_extension' => ['name' => 'media_extension', 'type' => 'string', 'internal' => 'extension'], 'media_size' => ['name' => 'media_size', 'type' => 'int', 'internal' => 'size'], diff --git a/Theme/Backend/template-functions.php b/Theme/Backend/template-functions.php index 864f92f..c9f4cc2 100644 --- a/Theme/Backend/template-functions.php +++ b/Theme/Backend/template-functions.php @@ -22,7 +22,7 @@ $fileIconFunction = function (int $extensionType) : string return 'file-image-o'; } elseif ($extensionType === ExtensionType::SPREADSHEET) { return 'file-excel-o'; - } elseif ($extensionType === 'collection') { + } elseif ($extensionType === ExtensionType::DIRECTORY) { return 'folder-open-o'; } diff --git a/info.json b/info.json index 9a0db2a..fc3c1b1 100644 --- a/info.json +++ b/info.json @@ -18,7 +18,8 @@ "directory": "Media", "dependencies": { "Admin": "1.0.0", - "Home": "1.0.0" + "Home": "1.0.0", + "Tag": "1.0.0" }, "providing": { "Navigation": "*"