mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-01 19:06:16 +01:00
Added Admin::getPageMedia() method
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
# v1.5.0-rc.3
|
# v1.5.0-rc.3
|
||||||
## 05/xx/2017
|
## 05/xx/2017
|
||||||
|
|
||||||
|
1. [](#new)
|
||||||
|
* New 'mediapicker' field
|
||||||
|
* New `Admin::getPageMedia()` static method that can be used in blueprints
|
||||||
1. [](#improved)
|
1. [](#improved)
|
||||||
* Various form styling improvements
|
* Various form styling improvements
|
||||||
* Provided an option to control how parent select field displays
|
* Provided an option to control how parent select field displays
|
||||||
|
|||||||
@@ -290,6 +290,25 @@ class Admin
|
|||||||
return $tmp_dir;
|
return $tmp_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getPageMedia()
|
||||||
|
{
|
||||||
|
$files = [];
|
||||||
|
$grav = Grav::instance();
|
||||||
|
|
||||||
|
$pages = $grav['pages'];
|
||||||
|
$route = '/' . ltrim($grav['admin']->route, '/');
|
||||||
|
|
||||||
|
/** @var Page $page */
|
||||||
|
$page = $pages->dispatch($route);
|
||||||
|
$parent_route = null;
|
||||||
|
if ($page) {
|
||||||
|
$media = $page->media()->all();
|
||||||
|
$files = array_keys($media);
|
||||||
|
}
|
||||||
|
return $files;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current session.
|
* Get current session.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user