mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-18 10:18:41 +00:00
Improved tag module and media virtual paths
This commit is contained in:
parent
be3780f262
commit
753b37b0b8
|
|
@ -42,6 +42,11 @@
|
||||||
"type": "VARCHAR(255)",
|
"type": "VARCHAR(255)",
|
||||||
"null": false
|
"null": false
|
||||||
},
|
},
|
||||||
|
"media_virtual": {
|
||||||
|
"name": "media_virtual",
|
||||||
|
"type": "VARCHAR(255)",
|
||||||
|
"null": false
|
||||||
|
},
|
||||||
"media_absolute": {
|
"media_absolute": {
|
||||||
"name": "media_absolute",
|
"name": "media_absolute",
|
||||||
"type": "TINYINT",
|
"type": "TINYINT",
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,14 @@ class Media implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
protected $path = '';
|
protected $path = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual path.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected $virtualPath = '/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is path absolute?
|
* Is path absolute?
|
||||||
*
|
*
|
||||||
|
|
@ -186,6 +194,16 @@ class Media implements \JsonSerializable
|
||||||
return $this->path;
|
return $this->path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function getVirtualPath() : string
|
||||||
|
{
|
||||||
|
return $this->virtualPath;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
|
|
@ -272,6 +290,18 @@ class Media implements \JsonSerializable
|
||||||
$this->path = \str_replace('\\', '/', $path);
|
$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)
|
* @param string $name Media name (not file name)
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ class MediaMapper extends DataMapperAbstract
|
||||||
'media_description_raw' => ['name' => 'media_description_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
|
'media_description_raw' => ['name' => 'media_description_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
|
||||||
'media_versioned' => ['name' => 'media_versioned', 'type' => 'bool', 'internal' => 'versioned'],
|
'media_versioned' => ['name' => 'media_versioned', 'type' => 'bool', 'internal' => 'versioned'],
|
||||||
'media_file' => ['name' => 'media_file', 'type' => 'string', 'internal' => 'path', 'autocomplete' => true],
|
'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_absolute' => ['name' => 'media_absolute', 'type' => 'bool', 'internal' => 'isAbsolute'],
|
||||||
'media_extension' => ['name' => 'media_extension', 'type' => 'string', 'internal' => 'extension'],
|
'media_extension' => ['name' => 'media_extension', 'type' => 'string', 'internal' => 'extension'],
|
||||||
'media_size' => ['name' => 'media_size', 'type' => 'int', 'internal' => 'size'],
|
'media_size' => ['name' => 'media_size', 'type' => 'int', 'internal' => 'size'],
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ $fileIconFunction = function (int $extensionType) : string
|
||||||
return 'file-image-o';
|
return 'file-image-o';
|
||||||
} elseif ($extensionType === ExtensionType::SPREADSHEET) {
|
} elseif ($extensionType === ExtensionType::SPREADSHEET) {
|
||||||
return 'file-excel-o';
|
return 'file-excel-o';
|
||||||
} elseif ($extensionType === 'collection') {
|
} elseif ($extensionType === ExtensionType::DIRECTORY) {
|
||||||
return 'folder-open-o';
|
return 'folder-open-o';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user