RC6
This commit is contained in:
@@ -64,6 +64,7 @@ return [
|
||||
'views' => [
|
||||
'login' => [
|
||||
'isOk',
|
||||
'isInstallable',
|
||||
'isInstalled',
|
||||
'title',
|
||||
'translation'
|
||||
|
@@ -53,6 +53,10 @@ return [
|
||||
throw new Exception('The server is not setup correctly');
|
||||
}
|
||||
|
||||
if ($system->isInstallable() === false) {
|
||||
throw new Exception('The panel cannot be installed');
|
||||
}
|
||||
|
||||
if ($system->isInstalled() === true) {
|
||||
throw new Exception('The panel is already installed');
|
||||
}
|
||||
|
@@ -87,21 +87,22 @@ function css($url, $options = null)
|
||||
return implode(PHP_EOL, $links);
|
||||
}
|
||||
|
||||
$href = $url === '@auto' ? Url::toTemplateAsset('css/templates', 'css') : Url::to($url);
|
||||
|
||||
$attr = [
|
||||
'href' => $href,
|
||||
'rel' => 'stylesheet'
|
||||
];
|
||||
|
||||
if (is_string($options) === true) {
|
||||
$attr['media'] = $options;
|
||||
$options = ['media' => $options];
|
||||
}
|
||||
|
||||
if (is_array($options) === true) {
|
||||
$attr = array_merge($options, $attr);
|
||||
$kirby = App::instance();
|
||||
|
||||
if ($component = $kirby->component('css')) {
|
||||
$url = $component($kirby, $url, $options);
|
||||
}
|
||||
|
||||
$url = $url === '@auto' ? Url::toTemplateAsset('css/templates', 'css') : Url::to($url);
|
||||
$attr = array_merge((array)$options, [
|
||||
'href' => $url,
|
||||
'rel' => 'stylesheet'
|
||||
]);
|
||||
|
||||
return '<link ' . attr($attr) . '>';
|
||||
}
|
||||
|
||||
@@ -334,19 +335,19 @@ function js($url, $options = null)
|
||||
return implode(PHP_EOL, $scripts);
|
||||
}
|
||||
|
||||
$src = $url === '@auto' ? Url::toTemplateAsset('js/templates', 'js') : Url::to($url);
|
||||
$attr = [
|
||||
'src' => $src,
|
||||
];
|
||||
|
||||
if (is_bool($options) === true) {
|
||||
$attr['async'] = $options;
|
||||
$options = ['async' => $options];
|
||||
}
|
||||
|
||||
if (is_array($options) === true) {
|
||||
$attr = array_merge($options, $attr);
|
||||
$kirby = App::instance();
|
||||
|
||||
if ($component = $kirby->component('js')) {
|
||||
$url = $component($kirby, $url, $options);
|
||||
}
|
||||
|
||||
$url = $url === '@auto' ? Url::toTemplateAsset('js/templates', 'js') : Url::to($url);
|
||||
$attr = array_merge((array)$options, ['src' => $url]);
|
||||
|
||||
return '<script ' . attr($attr) . '></script>';
|
||||
}
|
||||
|
||||
|
@@ -119,8 +119,17 @@ return function (App $app) {
|
||||
*
|
||||
* @return Files
|
||||
*/
|
||||
'toFiles' => function (Field $field) {
|
||||
return $field->parent()->files()->find(false, false, ...$field->toData('yaml'));
|
||||
'toFiles' => function (Field $field, string $separator = 'yaml') {
|
||||
$parent = $field->parent();
|
||||
$files = new Files([]);
|
||||
|
||||
foreach ($field->toData($separator) as $id) {
|
||||
if ($file = $parent->kirby()->file($id, $parent)) {
|
||||
$files->add($file);
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -226,8 +235,8 @@ return function (App $app) {
|
||||
*
|
||||
* @return Users
|
||||
*/
|
||||
'toUsers' => function (Field $field) use ($app) {
|
||||
return $app->users()->find(false, false, ...$field->toData('yaml'));
|
||||
'toUsers' => function (Field $field, string $separator = 'yaml') use ($app) {
|
||||
return $app->users()->find(false, false, ...$field->toData($separator));
|
||||
},
|
||||
|
||||
// inspectors
|
||||
|
Reference in New Issue
Block a user