Improved tag module and media virtual paths

This commit is contained in:
Dennis Eichhorn 2019-05-22 07:47:03 +02:00
parent be3780f262
commit 753b37b0b8
5 changed files with 39 additions and 2 deletions

View File

@ -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",

View File

@ -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)
*

View File

@ -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'],

View File

@ -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';
}

View File

@ -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": "*"