forked from snipiba/oc-memetadata-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.php
More file actions
74 lines (62 loc) · 2.02 KB
/
Plugin.php
File metadata and controls
74 lines (62 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php namespace SNiPI\MEMetadata;
use Config;
use Illuminate\Filesystem\Filesystem;
use Backend\Widgets\MediaManager;
use System\Classes\PluginBase;
use SNiPI\MEMetadata\Classes\MEMetadata as MetadataController;
use SNiPI\MEMetadata\Models\MediaLibraryItemMetadata;
class Plugin extends PluginBase
{
public function pluginDetails()
{
return [
'name' => 'Media Editor Metadata',
'description' => 'Handle file metadata for media manager',
'author' => 'SNiPI',
'icon' => 'icon-picture-o',
'iconSvg' => 'plugins/snipi/uniquemdiafinder/assets/img/search.svg',
'homepage' => 'https://github.com/snipiba/oc-memetadata-plugin'
];
}
public function registerSettings()
{
return [
'config' => [
'label' => 'Media metadata',
'icon' => 'icon-picture-o',
'category' => 'Tools',
'description' => 'Provide SEO and metadata to your files in media library.',
'class' => 'SNiPI\MEMetadata\Models\Settings',
'order' => 600
]
];
}
public function registerMarkupTags()
{
return [
'filters' => [
'metadata' => [$this, 'getMediaInfo'],
]
];
}
public function getMediaInfo($value) {
$mediaFolder = Config::get('cms.storage.media.folder', 'media');
$data = MediaLibraryItemMetadata::where('filepath', 'like','%' . $value)->first();
if($data) {
return $data;
}
}
public function boot() {
$manager = new MetadataController;
}
public function registerPageSnippets() {
return [
\SNiPI\MEmetadata\Components\ImageBlock::class => 'imageBlock'
];
}
public function registerComponents() {
return [
\SNiPI\MEmetadata\Components\ImageBlock::class => 'imageBlock'
];
}
}