Format php files

This commit is contained in:
Giuseppe Criscione 2024-04-27 13:06:15 +02:00
parent 085cef77a7
commit a18df4a0f8
100 changed files with 424 additions and 468 deletions

View File

@ -24,5 +24,4 @@ return function (App $app) {
throw new ValidationException(sprintf('Invalid value for field "%s" of type "%s"', $field->name(), $field->type())); throw new ValidationException(sprintf('Invalid value for field "%s" of type "%s"', $field->name(), $field->type()));
}, },
]; ];
}; };

View File

@ -48,5 +48,4 @@ return function (Languages $languages) {
} }
}, },
]; ];
}; };

View File

@ -30,5 +30,4 @@ return function (App $app) {
return $value; return $value;
}, },
]; ];
}; };

View File

@ -20,5 +20,4 @@ return function (App $app) {
'names' => LanguageCodes::names(), 'names' => LanguageCodes::names(),
], ],
]; ];
}; };

View File

@ -36,5 +36,4 @@ return function (App $app) {
return $value; return $value;
}, },
]; ];
}; };

View File

@ -24,5 +24,4 @@ return function (App $app) {
return $value; return $value;
}, },
]; ];
}; };

View File

@ -46,5 +46,4 @@ return function (Site $site) {
return str_replace("\r\n", "\n", (string) $value); return str_replace("\r\n", "\n", (string) $value);
}, },
]; ];
}; };

View File

@ -32,5 +32,4 @@ return function (App $app) {
return (string) $value; return (string) $value;
}, },
]; ];
}; };

View File

@ -30,5 +30,4 @@ return function (App $app) {
return $value; return $value;
}, },
]; ];
}; };

View File

@ -37,5 +37,4 @@ return function (App $app) {
return array_values(array_filter($value)); return array_values(array_filter($value));
}, },
]; ];
}; };

View File

@ -32,5 +32,4 @@ return function (App $app) {
return (string) $value; return (string) $value;
}, },
]; ];
}; };

View File

@ -27,5 +27,4 @@ return function (App $app) {
return str_replace("\r\n", "\n", (string) $value); return str_replace("\r\n", "\n", (string) $value);
}, },
]; ];
}; };

View File

@ -14,7 +14,6 @@ class ErrorHandlers
{ {
public function __construct(protected ViewFactory $viewFactory, protected Request $request) public function __construct(protected ViewFactory $viewFactory, protected Request $request)
{ {
} }
/** /**

View File

@ -11,7 +11,6 @@ class FieldFactory
{ {
public function __construct(protected Container $container, protected Config $config, protected Translations $translations) public function __construct(protected Container $container, protected Config $config, protected Translations $translations)
{ {
} }
/** /**

View File

@ -163,7 +163,6 @@ class File implements Arrayable, Stringable
return $this->hash = $hash; return $this->hash = $hash;
} }
throw new RuntimeException('Cannot calculate file hash'); throw new RuntimeException('Cannot calculate file hash');
} }
public function setUriGenerator(FileUriGenerator $uriGenerator): void public function setUriGenerator(FileUriGenerator $uriGenerator): void

View File

@ -14,7 +14,6 @@ class FileFactory
*/ */
public function __construct(protected Container $container, protected array $associations = []) public function __construct(protected Container $container, protected array $associations = [])
{ {
} }
public function make(string $path): File public function make(string $path): File

View File

@ -14,7 +14,6 @@ class FileUploader
{ {
public function __construct(protected Config $config) public function __construct(protected Config $config)
{ {
} }
/** /**

View File

@ -13,7 +13,6 @@ class FileUriGenerator
{ {
public function __construct(protected Config $config, protected Router $router, protected Site $site) public function __construct(protected Config $config, protected Router $router, protected Site $site)
{ {
} }
public function generate(File $file): string public function generate(File $file): string

View File

@ -35,8 +35,10 @@ class JpegHandler extends AbstractHandler
]; ];
foreach ($this->decoder->decode($this->data) as $segment) { foreach ($this->decoder->decode($this->data) as $segment) {
if ($segment['type'] > 0xbf && $segment['type'] < 0xc3 if (
|| $segment['type'] > 0xc8 && $segment['type'] < 0xcc) { $segment['type'] > 0xbf && $segment['type'] < 0xc3
|| $segment['type'] > 0xc8 && $segment['type'] < 0xcc
) {
$info['colorDepth'] = ord($segment['value'][0]); $info['colorDepth'] = ord($segment['value'][0]);
$info['height'] = unpack('n', $segment['value'], 1)[1]; $info['height'] = unpack('n', $segment['value'], 1)[1];
$info['width'] = unpack('n', $segment['value'], 3)[1]; $info['width'] = unpack('n', $segment['value'], 3)[1];

View File

@ -9,7 +9,6 @@ class Desaturate extends AbstractTransform
{ {
final public function __construct() final public function __construct()
{ {
} }
public static function fromArray(array $data): static public static function fromArray(array $data): static

View File

@ -9,7 +9,6 @@ class EdgeDetect extends AbstractTransform
{ {
final public function __construct() final public function __construct()
{ {
} }
public static function fromArray(array $data): static public static function fromArray(array $data): static

View File

@ -9,7 +9,6 @@ class Emboss extends AbstractTransform
{ {
final public function __construct() final public function __construct()
{ {
} }
public static function fromArray(array $data): static public static function fromArray(array $data): static

View File

@ -9,7 +9,6 @@ class Invert extends AbstractTransform
{ {
final public function __construct() final public function __construct()
{ {
} }
public static function fromArray(array $data): static public static function fromArray(array $data): static

View File

@ -9,7 +9,6 @@ class Sharpen extends AbstractTransform
{ {
final public function __construct() final public function __construct()
{ {
} }
public static function fromArray(array $data): static public static function fromArray(array $data): static

View File

@ -9,7 +9,6 @@ class Smoothen extends AbstractTransform
{ {
final public function __construct() final public function __construct()
{ {
} }
public static function fromArray(array $data): static public static function fromArray(array $data): static

View File

@ -8,7 +8,6 @@ class TemplateFactory
{ {
public function __construct(protected Container $container) public function __construct(protected Container $container)
{ {
} }
public function make(string $name): Template public function make(string $name): Template

View File

@ -72,7 +72,6 @@ class BackupController extends AbstractController
return $this->redirectToReferer(default: '/dashboard/'); return $this->redirectToReferer(default: '/dashboard/');
} }
throw new RuntimeException($this->translate('panel.backup.error.cannotDelete.invalidFilename')); throw new RuntimeException($this->translate('panel.backup.error.cannotDelete.invalidFilename'));
} catch (TranslatedException $e) { } catch (TranslatedException $e) {
$this->panel()->notify($this->translate('panel.backup.error.cannotDelete', $e->getTranslatedMessage()), 'error'); $this->panel()->notify($this->translate('panel.backup.error.cannotDelete', $e->getTranslatedMessage()), 'error');
return $this->redirectToReferer(default: '/dashboard/'); return $this->redirectToReferer(default: '/dashboard/');

View File

@ -75,8 +75,8 @@ class ErrorsController extends AbstractController
'title' => $throwable->getMessage(), 'title' => $throwable->getMessage(),
'body' => sprintf( 'body' => sprintf(
"### Description\n\n[Please enter a description and the steps to reproduce the problem...]\n\n" . "### Description\n\n[Please enter a description and the steps to reproduce the problem...]\n\n" .
"**Formwork**: %s\n**Php**: %s\n**OS**: %s\n**SAPI**: %s\n\n" . "**Formwork**: %s\n**Php**: %s\n**OS**: %s\n**SAPI**: %s\n\n" .
"### Stack Trace\n```\nUncaught %s: %s in %s:%s\n\n%s\n", "### Stack Trace\n```\nUncaught %s: %s in %s:%s\n\n%s\n",
$this->app::VERSION, $this->app::VERSION,
PHP_VERSION, PHP_VERSION,
PHP_OS_FAMILY, PHP_OS_FAMILY,

View File

@ -111,7 +111,7 @@ class PagesController extends AbstractController
if ($page === null) { if ($page === null) {
$this->panel()->notify($this->translate('panel.pages.page.cannotEdit.pageNotFound'), 'error'); $this->panel()->notify($this->translate('panel.pages.page.cannotEdit.pageNotFound'), 'error');
return $this->redirectToReferer(default: '/pages/'); return $this->redirectToReferer(default: '/pages/');
} }
if ($routeParams->has('language')) { if ($routeParams->has('language')) {
@ -130,7 +130,6 @@ class PagesController extends AbstractController
throw new UnexpectedValueException('Unexpected missing page route'); throw new UnexpectedValueException('Unexpected missing page route');
} }
return $this->redirect($this->generateRoute('panel.pages.edit.lang', ['page' => trim($page->route(), '/'), 'language' => $this->site()->languages()->default()])); return $this->redirect($this->generateRoute('panel.pages.edit.lang', ['page' => trim($page->route(), '/'), 'language' => $this->site()->languages()->default()]));
} }
if ($page->languages()->available()->has($language)) { if ($page->languages()->available()->has($language)) {
@ -278,7 +277,7 @@ class PagesController extends AbstractController
if ($page === null) { if ($page === null) {
$this->panel()->notify($this->translate('panel.pages.page.cannotDelete.pageNotFound'), 'error'); $this->panel()->notify($this->translate('panel.pages.page.cannotDelete.pageNotFound'), 'error');
return $this->redirectToReferer(default: '/pages/'); return $this->redirectToReferer(default: '/pages/');
} }
if ($routeParams->has('language')) { if ($routeParams->has('language')) {
@ -287,13 +286,13 @@ class PagesController extends AbstractController
$page->setLanguage($language); $page->setLanguage($language);
} else { } else {
$this->panel()->notify($this->translate('panel.pages.page.cannotDelete.invalidLanguage', $language), 'error'); $this->panel()->notify($this->translate('panel.pages.page.cannotDelete.invalidLanguage', $language), 'error');
return $this->redirectToReferer(default: '/pages/'); return $this->redirectToReferer(default: '/pages/');
} }
} }
if (!$page->isDeletable()) { if (!$page->isDeletable()) {
$this->panel()->notify($this->translate('panel.pages.page.cannotDelete.notDeletable'), 'error'); $this->panel()->notify($this->translate('panel.pages.page.cannotDelete.notDeletable'), 'error');
return $this->redirectToReferer(default: '/pages/'); return $this->redirectToReferer(default: '/pages/');
} }
if ($page->path() !== null) { if ($page->path() !== null) {
@ -325,7 +324,7 @@ class PagesController extends AbstractController
if ($page === null) { if ($page === null) {
$this->panel()->notify($this->translate('panel.pages.page.cannotUploadFile.pageNotFound'), 'error'); $this->panel()->notify($this->translate('panel.pages.page.cannotUploadFile.pageNotFound'), 'error');
return $this->redirectToReferer(default: '/pages/'); return $this->redirectToReferer(default: '/pages/');
} }
if (!$this->request->files()->isEmpty()) { if (!$this->request->files()->isEmpty()) {
@ -334,7 +333,6 @@ class PagesController extends AbstractController
} catch (TranslatedException $e) { } catch (TranslatedException $e) {
$this->panel()->notify($this->translate('upload.error', $e->getTranslatedMessage()), 'error'); $this->panel()->notify($this->translate('upload.error', $e->getTranslatedMessage()), 'error');
return $this->redirect($this->generateRoute('panel.pages.edit', ['page' => $routeParams->get('page')])); return $this->redirect($this->generateRoute('panel.pages.edit', ['page' => $routeParams->get('page')]));
} }
} }
@ -353,7 +351,7 @@ class PagesController extends AbstractController
if ($page === null) { if ($page === null) {
$this->panel()->notify($this->translate('panel.pages.page.cannotDeleteFile.pageNotFound'), 'error'); $this->panel()->notify($this->translate('panel.pages.page.cannotDeleteFile.pageNotFound'), 'error');
return $this->redirectToReferer(default: '/pages/'); return $this->redirectToReferer(default: '/pages/');
} }
if (!$page->files()->has($routeParams->get('filename'))) { if (!$page->files()->has($routeParams->get('filename'))) {
@ -365,7 +363,6 @@ class PagesController extends AbstractController
$this->panel()->notify($this->translate('panel.pages.page.fileDeleted'), 'success'); $this->panel()->notify($this->translate('panel.pages.page.fileDeleted'), 'success');
return $this->redirect($this->generateRoute('panel.pages.edit', ['page' => $routeParams->get('page')])); return $this->redirect($this->generateRoute('panel.pages.edit', ['page' => $routeParams->get('page')]));
} }
/** /**
@ -379,7 +376,7 @@ class PagesController extends AbstractController
if ($page === null) { if ($page === null) {
$this->panel()->notify($this->translate('panel.pages.page.cannotRenameFile.pageNotFound'), 'error'); $this->panel()->notify($this->translate('panel.pages.page.cannotRenameFile.pageNotFound'), 'error');
return $this->redirectToReferer(default: '/pages/'); return $this->redirectToReferer(default: '/pages/');
} }
if (!$page->files()->has($routeParams->get('filename'))) { if (!$page->files()->has($routeParams->get('filename'))) {

View File

@ -196,7 +196,6 @@ class UsersController extends AbstractController
$userData = [...$user->toArray(), ...$data]; $userData = [...$user->toArray(), ...$data];
Yaml::encodeToFile($userData, FileSystem::joinPaths($this->config->get('system.panel.paths.accounts'), $user->username() . '.yaml')); Yaml::encodeToFile($userData, FileSystem::joinPaths($this->config->get('system.panel.paths.accounts'), $user->username() . '.yaml'));
} }
/** /**

View File

@ -8,7 +8,6 @@ class UserFactory
{ {
public function __construct(protected Container $container) public function __construct(protected Container $container)
{ {
} }
/** /**

View File

@ -24,7 +24,6 @@ class Schemes
public function __construct(protected Container $container) public function __construct(protected Container $container)
{ {
} }
/** /**

View File

@ -166,13 +166,10 @@ class Container
$loaderInstance = $this->build($loader, $parameters); $loaderInstance = $this->build($loader, $parameters);
$service = $loaderInstance->load($this); $service = $loaderInstance->load($this);
} elseif ($object === null) { } elseif ($object === null) {
$service = $this->build($name, $parameters); $service = $this->build($name, $parameters);
} elseif ($object instanceof Closure) { } elseif ($object instanceof Closure) {
$service = $this->call($object, $parameters); $service = $this->call($object, $parameters);
} else { } else {
$service = $object; $service = $object;
} }

View File

@ -12,7 +12,6 @@ class LanguagesServiceLoader implements ServiceLoaderInterface
{ {
public function __construct(protected Config $config, protected Request $request) public function __construct(protected Config $config, protected Request $request)
{ {
} }
public function load(Container $container): Languages public function load(Container $container): Languages

View File

@ -13,7 +13,6 @@ class SchemesServiceLoader implements ResolutionAwareServiceLoaderInterface
{ {
public function __construct(protected Config $config, protected Languages $languages) public function __construct(protected Config $config, protected Languages $languages)
{ {
} }
public function load(Container $container): object public function load(Container $container): object

View File

@ -15,7 +15,6 @@ class SiteServiceLoader implements ResolutionAwareServiceLoaderInterface
{ {
public function __construct(protected Config $config, protected Languages $languages, protected Schemes $schemes) public function __construct(protected Config $config, protected Languages $languages, protected Schemes $schemes)
{ {
} }
public function load(Container $container): Site public function load(Container $container): Site
@ -28,7 +27,6 @@ class SiteServiceLoader implements ResolutionAwareServiceLoaderInterface
'path' => $this->config->get('system.content.path'), 'path' => $this->config->get('system.content.path'),
'languages' => $this->languages, 'languages' => $this->languages,
] + $config]); ] + $config]);
} }
/** /**

View File

@ -12,7 +12,6 @@ class TranslationsServiceLoader implements ResolutionAwareServiceLoaderInterface
{ {
public function __construct(protected Config $config, protected Languages $languages) public function __construct(protected Config $config, protected Languages $languages)
{ {
} }
public function load(Container $container): object public function load(Container $container): object

View File

@ -200,11 +200,10 @@ class Debug
$reference = ReflectionReference::fromArrayElement($data, $key) !== null; $reference = ReflectionReference::fromArrayElement($data, $key) !== null;
$parts[] = str_repeat(' ', $indent + self::INDENT_SPACES) $parts[] = str_repeat(' ', $indent + self::INDENT_SPACES)
. ($associative ? static::outputData($key) . ' => ' : '') . ($associative ? static::outputData($key) . ' => ' : '')
. ($reference ? '<span class="__note" title="Reference">&</span>' : '') . ($reference ? '<span class="__note" title="Reference">&</span>' : '')
. static::outputData($value, $indent + self::INDENT_SPACES) . static::outputData($value, $indent + self::INDENT_SPACES)
. ','; . ',';
} }
return sprintf("<span class=\"__type-array\">array</span>(<span class=\"__note\">%d</span>) [<span class=\"__formwork-dump-toggle\" onclick=\"__formwork_dump_toggle(this)\" data-target=\"__formwork-dump-id-%2\$d\">▼</span>\n<div class=\"__formwork-dump-collapsed\" id=\"__formwork-dump-id-%d\">%s</div>%s]", count($data), ++static::$counter, implode("\n", $parts), str_repeat(' ', $indent)); return sprintf("<span class=\"__type-array\">array</span>(<span class=\"__note\">%d</span>) [<span class=\"__formwork-dump-toggle\" onclick=\"__formwork_dump_toggle(this)\" data-target=\"__formwork-dump-id-%2\$d\">▼</span>\n<div class=\"__formwork-dump-collapsed\" id=\"__formwork-dump-id-%d\">%s</div>%s]", count($data), ++static::$counter, implode("\n", $parts), str_repeat(' ', $indent));

View File

@ -157,7 +157,6 @@ class MimeType
$mimeType = static::fromExtension('svg'); $mimeType = static::fromExtension('svg');
} }
} }
} }
return $mimeType ?: self::DEFAULT_MIME_TYPE; return $mimeType ?: self::DEFAULT_MIME_TYPE;

View File

@ -13,7 +13,6 @@ class ViewFactory
*/ */
public function __construct(protected array $methods, protected App $app, protected Config $config) public function __construct(protected array $methods, protected App $app, protected Config $config)
{ {
} }
/** /**

View File

@ -1,5 +1,5 @@
<?php $this->insert('errors.partials.header') ?> <?php $this->insert('errors.partials.header') ?>
<h2>Oops, something went wrong!</h2> <h2>Oops, something went wrong!</h2>
<p>Formwork encountered an error while serving your request.<br>If you are the maintainer of this site, please check Formwork configuration or the server log for errors.</p> <p>Formwork encountered an error while serving your request.<br>If you are the maintainer of this site, please check Formwork configuration or the server log for errors.</p>
<p><a href="https://github.com/getformwork/formwork/issues" target="_blank">Report an issue to GitHub</a></p> <p><a href="https://github.com/getformwork/formwork/issues" target="_blank">Report an issue to GitHub</a></p>
<?php $this->insert('errors.partials.footer') ?> <?php $this->insert('errors.partials.footer') ?>

View File

@ -1,5 +1,5 @@
<?php header(($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0') . ' 500 Internal Server Error'); ?> <?php header(($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0') . ' 500 Internal Server Error'); ?>
<?php include __DIR__ . '/partials/header.php' ?> <?php include __DIR__ . '/partials/header.php' ?>
<h2>The site is currently offline<br>due to technical problems</h2> <h2>The site is currently offline<br>due to technical problems</h2>
<p>If you are the maintainer of this site, please run <code>composer install</code>. Composer autoloader was not found.</p> <p>If you are the maintainer of this site, please run <code>composer install</code>. Composer autoloader was not found.</p>
<?php include __DIR__ . '/partials/footer.php' ?> <?php include __DIR__ . '/partials/footer.php' ?>

View File

@ -1,4 +1,4 @@
<?php $this->insert('errors.partials.header') ?> <?php $this->insert('errors.partials.header') ?>
<h2>We are coming back soon</h2> <h2>We are coming back soon</h2>
<p>The website is currently in maintenance mode.</p> <p>The website is currently in maintenance mode.</p>
<?php $this->insert('errors.partials.footer') ?> <?php $this->insert('errors.partials.footer') ?>

View File

@ -1,3 +1,4 @@
</div> </div>
</body> </body>
</html>
</html>

View File

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title><?= $message ?? 'Internal Server Error' ?> | Formwork</title> <title><?= $message ?? 'Internal Server Error' ?> | Formwork</title>
<meta charset="utf-8"> <meta charset="utf-8">
@ -19,7 +20,8 @@
text-align: center; text-align: center;
} }
h1, h2 { h1,
h2 {
margin-top: 0; margin-top: 0;
letter-spacing: -0.027rem; letter-spacing: -0.027rem;
line-height: 1.2; line-height: 1.2;
@ -71,9 +73,10 @@
} }
</style> </style>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h1> <h1>
<span class="error-code"><?= $status ?? 500 ?></span> <span class="error-code"><?= $status ?? 500 ?></span>
<span class="error-status"><?= $message ?? 'Internal Server Error' ?></span> <span class="error-status"><?= $message ?? 'Internal Server Error' ?></span>
</h1> </h1>

View File

@ -1,5 +1,5 @@
<?php header(($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0') . ' 500 Internal Server Error'); ?> <?php header(($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0') . ' 500 Internal Server Error'); ?>
<?php include __DIR__ . '/partials/header.php' ?> <?php include __DIR__ . '/partials/header.php' ?>
<h2>The site is currently offline<br>due to technical problems</h2> <h2>The site is currently offline<br>due to technical problems</h2>
<p>If you are the maintainer of this site, please switch to a PHP version supported by the installed release of Formwork.</p> <p>If you are the maintainer of this site, please switch to a PHP version supported by the installed release of Formwork.</p>
<?php include __DIR__ . '/partials/footer.php' ?> <?php include __DIR__ . '/partials/footer.php' ?>

View File

@ -10,5 +10,4 @@ return function (Config $config, Panel $panel) {
'icon' => fn (string $icon) => FileSystem::read(FileSystem::joinPaths($config->get('system.panel.paths.assets'), '/icons/svg/', $icon . '.svg')), 'icon' => fn (string $icon) => FileSystem::read(FileSystem::joinPaths($config->get('system.panel.paths.assets'), '/icons/svg/', $icon . '.svg')),
]; ];
}; };

View File

@ -2,9 +2,9 @@
<div class="caption"><?= $this->translate('panel.login.login') ?></div> <div class="caption"><?= $this->translate('panel.login.login') ?></div>
<form action="<?= $panel->uri('/login/') ?>" method="post"> <form action="<?= $panel->uri('/login/') ?>" method="post">
<label class="form-label" for="username"><?= $this->translate('panel.login.username') ?>:</label> <label class="form-label" for="username"><?= $this->translate('panel.login.username') ?>:</label>
<input class="form-input" id="username" type="text" required name="username" <?php if (!empty($username)): ?>value="<?= $username ?>" <?php else: ?>autofocus<?php endif ?> maxlength="20"> <input class="form-input" id="username" type="text" required name="username" <?php if (!empty($username)) : ?>value="<?= $username ?>" <?php else : ?>autofocus<?php endif ?> maxlength="20">
<label class="form-label" for="password"><?= $this->translate('panel.login.password') ?>:</label> <label class="form-label" for="password"><?= $this->translate('panel.login.password') ?>:</label>
<input class="form-input" <?php if (!empty($error)): ?>class="form-input-invalid" autofocus <?php endif ?>id="password" type="password" required name="password"> <input class="form-input" <?php if (!empty($error)) : ?>class="form-input-invalid" autofocus <?php endif ?>id="password" type="password" required name="password">
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>"> <input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
<button type="submit" class="button button-accent mt-8"><?= $this->icon('arrow-right-circle') ?> <?= $this->translate('panel.login.login') ?></button> <button type="submit" class="button button-accent mt-8"><?= $this->icon('arrow-right-circle') ?> <?= $this->translate('panel.login.login') ?></button>
</form> </form>

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title><?php if (!empty($title)): ?><?= $title ?> | <?php endif ?>Formwork</title> <title><?php if (!empty($title)) : ?><?= $title ?> | <?php endif ?>Formwork</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
<link rel="icon" type="image/svg+xml" href="<?= $this->assets()->uri('images/icon.svg') ?>"> <link rel="icon" type="image/svg+xml" href="<?= $this->assets()->uri('images/icon.svg') ?>">
@ -21,10 +21,10 @@
<div class="logo" style="background-image: url(<?= $this->assets()->uri('images/icon.svg') ?>);"></div> <div class="logo" style="background-image: url(<?= $this->assets()->uri('images/icon.svg') ?>);"></div>
<h2><?= $heading ?></h2> <h2><?= $heading ?></h2>
<p><?= $description ?></p> <p><?= $description ?></p>
<?php if (isset($action)): ?><a class="action" href="<?= $action['href'] ?>"><?= $action['label'] ?></a><?php endif ?> <?php if (isset($action)) : ?><a class="action" href="<?= $action['href'] ?>"><?= $action['label'] ?></a><?php endif ?>
</div> </div>
</div> </div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -1 +1 @@
<?php $this->insert('fields.layout.' . $fields->layout()->type(), ['sections' => $fields->layout()->sections()]) ?> <?php $this->insert('fields.layout.' . $fields->layout()->type(), ['sections' => $fields->layout()->sections()]) ?>

View File

@ -1,30 +1,30 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<div <?= $this->attr([ <div <?= $this->attr([
'class' => ['form-input-array', $field->get('associative') ? 'form-input-array-associative' : ''], 'class' => ['form-input-array', $field->get('associative') ? 'form-input-array-associative' : ''],
'id' => $field->name(), 'id' => $field->name(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
'data-name' => $field->formName(), 'data-name' => $field->formName(),
]) ?>>
<?php foreach ($field->value() ?: ['' => ''] as $key => $value): ?>
<div class="form-input-array-row">
<span class="sortable-handle" title="<?= $this->translate('panel.dragToReorder') ?>"><?= $this->icon('grabber') ?></span>
<?php if ($field->get('associative')): ?>
<input <?= $this->attr([
'type' => 'text',
'class' => ['form-input', 'form-input-array-key'],
'value' => $key,
'placeholder' => $field->get('placeholderKey'),
]) ?>> ]) ?>>
<?php endif ?> <?php foreach ($field->value() ?: ['' => ''] as $key => $value) : ?>
<input <?= $this->attr([ <div class="form-input-array-row">
'type' => 'text', <span class="sortable-handle" title="<?= $this->translate('panel.dragToReorder') ?>"><?= $this->icon('grabber') ?></span>
'class' => ['form-input', 'form-input-array-value'], <?php if ($field->get('associative')) : ?>
'name' => $field->formName() . ($field->get('associative') ? '[' . $key . ']' : '[]'), <input <?= $this->attr([
'value' => $value, 'type' => 'text',
'placeholder' => $field->get('placeholderValue'), 'class' => ['form-input', 'form-input-array-key'],
]) ?>> 'value' => $key,
<button type="button" class="button button-link form-input-array-remove" title="<?= $this->translate('fields.array.remove') ?>" aria-label="<?= $this->translate('fields.array.remove') ?>"><?= $this->icon('minus-circle') ?></button> 'placeholder' => $field->get('placeholderKey'),
<button type="button" class="button button-link form-input-array-add" title="<?= $this->translate('fields.array.add') ?>" aria-label="<?= $this->translate('fields.array.add') ?>"><?= $this->icon('plus-circle') ?></button> ]) ?>>
</div> <?php endif ?>
<?php endforeach ?> <input <?= $this->attr([
</div> 'type' => 'text',
'class' => ['form-input', 'form-input-array-value'],
'name' => $field->formName() . ($field->get('associative') ? '[' . $key . ']' : '[]'),
'value' => $value,
'placeholder' => $field->get('placeholderValue'),
]) ?>>
<button type="button" class="button button-link form-input-array-remove" title="<?= $this->translate('fields.array.remove') ?>" aria-label="<?= $this->translate('fields.array.remove') ?>"><?= $this->icon('minus-circle') ?></button>
<button type="button" class="button button-link form-input-array-add" title="<?= $this->translate('fields.array.add') ?>" aria-label="<?= $this->translate('fields.array.add') ?>"><?= $this->icon('plus-circle') ?></button>
</div>
<?php endforeach ?>
</div>

View File

@ -1,16 +1,16 @@
<div> <div>
<label class="form-label form-checkbox-label"> <label class="form-label form-checkbox-label">
<input <?= $this->attr([ <input <?= $this->attr([
'type' => 'checkbox', 'type' => 'checkbox',
'class' => ['form-input', 'form-checkbox'], 'class' => ['form-input', 'form-checkbox'],
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'checked' => $field->value() == true, 'checked' => $field->value() == true,
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>
<span class="form-checkbox-text"><?= $field->label() ?></span> <span class="form-checkbox-text"><?= $field->label() ?></span>
</label> </label>
</div> </div>
<?php $this->insert('fields.partials.description') ?> <?php $this->insert('fields.partials.description') ?>

View File

@ -1,15 +1,15 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<div class="form-input-wrap"> <div class="form-input-wrap">
<input <?= $this->attr([ <input <?= $this->attr([
'type' => 'text', 'type' => 'text',
'class' => ['form-input', 'form-input-date'], 'class' => ['form-input', 'form-input-date'],
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'value' => $field->value(), 'value' => $field->value(),
'placeholder' => $field->placeholder(), 'placeholder' => $field->placeholder(),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>
<span class="form-input-reset" data-reset="<?= $field->name() ?>"><?= $this->icon('times-circle') ?></span> <span class="form-input-reset" data-reset="<?= $field->name() ?>"><?= $this->icon('times-circle') ?></span>
</div> </div>

View File

@ -1,17 +1,17 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<input <?= $this->attr([ <input <?= $this->attr([
'class' => 'form-input', 'class' => 'form-input',
'type' => 'number', 'type' => 'number',
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'min' => $field->get('min'), 'min' => $field->get('min'),
'max' => $field->get('max'), 'max' => $field->get('max'),
'step' => $field->get('step'), 'step' => $field->get('step'),
'value' => $field->value(), 'value' => $field->value(),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
'data-field' => 'duration', 'data-field' => 'duration',
'data-unit' => $field->get('unit', 'seconds'), 'data-unit' => $field->get('unit', 'seconds'),
'data-intervals' => $field->has('intervals') ? implode(', ', $field->get('intervals')) : null, 'data-intervals' => $field->has('intervals') ? implode(', ', $field->get('intervals')) : null,
]) ?>> ]) ?>>

View File

@ -1,16 +1,15 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<input <?= $this->attr([ <input <?= $this->attr([
'class' => 'form-input', 'class' => 'form-input',
'type' => 'email', 'type' => 'email',
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'value' => $field->value(), 'value' => $field->value(),
'placeholder' => $field->placeholder(), 'placeholder' => $field->placeholder(),
'minlength' => $field->get('min'), 'minlength' => $field->get('min'),
'maxlength' => $field->get('max'), 'maxlength' => $field->get('max'),
'pattern' => $field->get('pattern'), 'pattern' => $field->get('pattern'),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>

View File

@ -1,19 +1,19 @@
<?php if ($field->has('label')): ?> <?php if ($field->has('label')) : ?>
<label class="form-label"><?= $field->label() ?></label> <label class="form-label"><?= $field->label() ?></label>
<?php endif ?> <?php endif ?>
<input <?= $this->attr([ <input <?= $this->attr([
'type' => 'file', 'type' => 'file',
'class' => ['form-input', 'form-input-file'], 'class' => ['form-input', 'form-input-file'],
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName() . ($field->get('multiple') ? '[]' : ''), 'name' => $field->formName() . ($field->get('multiple') ? '[]' : ''),
'accept' => $field->get('accept', implode(', ', $app->config()->get('system.files.allowedExtensions'))), 'accept' => $field->get('accept', implode(', ', $app->config()->get('system.files.allowedExtensions'))),
'data-auto-upload' => $field->get('autoUpload') ? 'true' : 'false', 'data-auto-upload' => $field->get('autoUpload') ? 'true' : 'false',
'multiple' => $field->get('multiple'), 'multiple' => $field->get('multiple'),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>
<label for="<?= $field->name() ?>" class="form-input-file-label"> <label for="<?= $field->name() ?>" class="form-input-file-label">
<span><?= $this->icon('cloud-upload') ?> <?= $this->translate('fields.file.uploadLabel') ?></span> <span><?= $this->icon('cloud-upload') ?> <?= $this->translate('fields.file.uploadLabel') ?></span>
</label> </label>
<?php $this->insert('fields.partials.description') ?> <?php $this->insert('fields.partials.description') ?>

View File

@ -1,16 +1,16 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<div class="form-input-wrap"> <div class="form-input-wrap">
<input <?= $this->attr([ <input <?= $this->attr([
'type' => 'text', 'type' => 'text',
'class' => ['form-input', 'form-input-image'], 'class' => ['form-input', 'form-input-image'],
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'value' => basename($field->value() ?? ''), 'value' => basename($field->value() ?? ''),
'placeholder' => $field->placeholder(), 'placeholder' => $field->placeholder(),
'readonly' => true, 'readonly' => true,
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>
<span class="form-input-reset" data-reset="<?= $field->name() ?>"><?= $this->icon('times-circle') ?></span> <span class="form-input-reset" data-reset="<?= $field->name() ?>"><?= $this->icon('times-circle') ?></span>
</div> </div>

View File

@ -1,7 +1,7 @@
<section class="section"> <section class="section">
<?php foreach ($fields as $field): ?> <?php foreach ($fields as $field) : ?>
<?php if ($field->isVisible()): ?> <?php if ($field->isVisible()) : ?>
<?php $this->insert('fields.' . $field->type(), ['field' => $field]) ?> <?php $this->insert('fields.' . $field->type(), ['field' => $field]) ?>
<?php endif ?> <?php endif ?>
<?php endforeach ?> <?php endforeach ?>
</section> </section>

View File

@ -1,19 +1,19 @@
<div class="sections"> <div class="sections">
<?php foreach ($sections as $section): ?> <?php foreach ($sections as $section) : ?>
<section <?= $this->attr(['class' => ['section', $section->is('collapsible') ? 'collapsible' : '', $section->is('collapsed') ? 'collapsed' : '']]) ?>> <section <?= $this->attr(['class' => ['section', $section->is('collapsible') ? 'collapsible' : '', $section->is('collapsed') ? 'collapsed' : '']]) ?>>
<div class="section-header"> <div class="section-header">
<?php if ($section->is('collapsible')): ?> <?php if ($section->is('collapsible')) : ?>
<button type="button" class="button section-toggle mr-2" title="<?= $this->translate('panel.sections.toggle') ?>" aria-label="<?= $this->translate('panel.sections.toggle') ?>"><?= $this->icon('chevron-up') ?></button> <button type="button" class="button section-toggle mr-2" title="<?= $this->translate('panel.sections.toggle') ?>" aria-label="<?= $this->translate('panel.sections.toggle') ?>"><?= $this->icon('chevron-up') ?></button>
<?php endif ?> <?php endif ?>
<span class="caption"><?= $section->label() ?></span> <span class="caption"><?= $section->label() ?></span>
</div> </div>
<div class="section-content"> <div class="section-content">
<?php foreach ($fields->getMultiple($section->get('fields', [])) as $field): ?> <?php foreach ($fields->getMultiple($section->get('fields', [])) as $field) : ?>
<?php if ($field->isVisible()): ?> <?php if ($field->isVisible()) : ?>
<?php $this->insert('fields.' . $field->type(), ['field' => $field]) ?> <?php $this->insert('fields.' . $field->type(), ['field' => $field]) ?>
<?php endif ?> <?php endif ?>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
</section> </section>
<?php endforeach ?> <?php endforeach ?>
</div> </div>

View File

@ -14,16 +14,16 @@
<button type="button" class="button toolbar-button" data-command="redo" title="<?= $this->translate('panel.pages.editor.redo') ?>" disabled><?= $this->icon('rotate-right') ?></button> <button type="button" class="button toolbar-button" data-command="redo" title="<?= $this->translate('panel.pages.editor.redo') ?>" disabled><?= $this->icon('rotate-right') ?></button>
</div> </div>
<textarea <?= $this->attr([ <textarea <?= $this->attr([
'class' => ['form-textarea', 'editor-textarea'], 'class' => ['form-textarea', 'editor-textarea'],
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'placeholder' => $field->placeholder(), 'placeholder' => $field->placeholder(),
'minlength' => $field->get('min'), 'minlength' => $field->get('min'),
'maxlength' => $field->get('max'), 'maxlength' => $field->get('max'),
'autocomplete' => $field->get('autocomplete', 'off'), 'autocomplete' => $field->get('autocomplete', 'off'),
'rows' => $field->get('rows', 15), 'rows' => $field->get('rows', 15),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>><?= $this->escape($field->value() ?? '') ?></textarea> ]) ?>><?= $this->escape($field->value() ?? '') ?></textarea>
</div> </div>

View File

@ -1,15 +1,15 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<input <?= $this->attr([ <input <?= $this->attr([
'class' => 'form-input', 'class' => 'form-input',
'type' => 'number', 'type' => 'number',
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'min' => $field->get('min'), 'min' => $field->get('min'),
'max' => $field->get('max'), 'max' => $field->get('max'),
'step' => $field->get('step'), 'step' => $field->get('step'),
'value' => $field->value(), 'value' => $field->value(),
'placeholder' => $field->placeholder(), 'placeholder' => $field->placeholder(),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>

View File

@ -1,31 +1,19 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<select <?= $this->attr([ <select <?= $this->attr([
'class' => 'form-select', 'class' => 'form-select',
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>
<?php <?php if (!$field->isRequired()) : ?>
if (!$field->isRequired()): <option value="" <?php if ($field->value() === '') : ?> selected<?php endif ?>><?= $this->translate('page.none') ?></option>
?> <?php endif ?>
<option value="" <?php if ($field->value() === ''): ?> selected<?php endif ?>><?= $this->translate('page.none') ?></option> <?php if ($field->get('allowSite')) : ?>
<?php <option value="." <?php if ($field->value() === '.') : ?> selected<?php endif ?>><?= $this->translate('panel.pages.newPage.site') ?> (/)</option>
endif <?php endif ?>
?> <?php foreach ($field->collection() as $page) : ?>
<?php <option value="<?= $page->route() ?>" <?php if ($page->route() === $field->value()) : ?> selected<?php endif ?>><?= str_repeat('— ', $page->level() - 1) . $page->title() ?></option>
if ($field->get('allowSite')): <?php endforeach ?>
?> </select>
<option value="." <?php if ($field->value() === '.'): ?> selected<?php endif ?>><?= $this->translate('panel.pages.newPage.site') ?> (/)</option>
<?php
endif
?>
<?php
foreach ($field->collection() as $page):
?>
<option value="<?= $page->route() ?>"<?php if ($page->route() === $field->value()): ?> selected<?php endif ?>><?= str_repeat('— ', $page->level() - 1) . $page->title() ?></option>
<?php
endforeach
?>
</select>

View File

@ -7,9 +7,9 @@
</div> </div>
<div class="files-items"> <div class="files-items">
<?php foreach ($page->files()->sort() as $file): ?> <?php foreach ($page->files()->sort() as $file) : ?>
<div class="files-item"> <div class="files-item">
<?php if ($file->type() === 'image'): ?> <?php if ($file->type() === 'image') : ?>
<div class="file-thumbnail" style="background-image:url('<?= $file->square(300, 'contain')->uri() ?>');"></div> <div class="file-thumbnail" style="background-image:url('<?= $file->square(300, 'contain')->uri() ?>');"></div>
<?php endif ?> <?php endif ?>
<div class="file-icon"><?= $this->icon(is_null($file->type()) ? 'file' : 'file-' . $file->type()) ?></div> <div class="file-icon"><?= $this->icon(is_null($file->type()) ? 'file' : 'file-' . $file->type()) ?></div>
@ -18,10 +18,10 @@
<button type="button" class="button button-link dropdown-button" title="<?= $this->translate('panel.files.actions') ?>" data-dropdown="dropdown-<?= $file->hash() ?>"><?= $this->icon('ellipsis-v') ?></button> <button type="button" class="button button-link dropdown-button" title="<?= $this->translate('panel.files.actions') ?>" data-dropdown="dropdown-<?= $file->hash() ?>"><?= $this->icon('ellipsis-v') ?></button>
<div class="dropdown-menu" id="dropdown-<?= $file->hash() ?>"> <div class="dropdown-menu" id="dropdown-<?= $file->hash() ?>">
<a class="dropdown-item" href="<?= $page->uri($file->name(), includeLanguage: false) ?>" target="formwork-preview-file-<?= $file->hash() ?>"><?= $this->icon('eye') ?> <?= $this->translate('panel.pages.previewFile') ?></a> <a class="dropdown-item" href="<?= $page->uri($file->name(), includeLanguage: false) ?>" target="formwork-preview-file-<?= $file->hash() ?>"><?= $this->icon('eye') ?> <?= $this->translate('panel.pages.previewFile') ?></a>
<?php if ($panel->user()->permissions()->has('pages.renameFiles')): ?> <?php if ($panel->user()->permissions()->has('pages.renameFiles')) : ?>
<a class="dropdown-item" data-modal="renameFileModal" data-modal-action="<?= $panel->uri('/pages/' . trim($page->route(), '/') . '/file/' . $file->name() . '/rename/') ?>" data-filename="<?= $file->name() ?>"><?= $this->icon('pencil') ?> <?= $this->translate('panel.pages.renameFile') ?></a> <a class="dropdown-item" data-modal="renameFileModal" data-modal-action="<?= $panel->uri('/pages/' . trim($page->route(), '/') . '/file/' . $file->name() . '/rename/') ?>" data-filename="<?= $file->name() ?>"><?= $this->icon('pencil') ?> <?= $this->translate('panel.pages.renameFile') ?></a>
<?php endif ?> <?php endif ?>
<?php if ($panel->user()->permissions()->has('pages.deleteFiles')): ?> <?php if ($panel->user()->permissions()->has('pages.deleteFiles')) : ?>
<a class="dropdown-item" data-modal="deleteFileModal" data-modal-action="<?= $panel->uri('/pages/' . trim($page->route(), '/') . '/file/' . $file->name() . '/delete/') ?>"><?= $this->icon('trash') ?> <?= $this->translate('panel.pages.deleteFile') ?></a> <a class="dropdown-item" data-modal="deleteFileModal" data-modal-action="<?= $panel->uri('/pages/' . trim($page->route(), '/') . '/file/' . $file->name() . '/delete/') ?>"><?= $this->icon('trash') ?> <?= $this->translate('panel.pages.deleteFile') ?></a>
<?php endif ?> <?php endif ?>
</div> </div>
@ -29,4 +29,4 @@
</div> </div>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
</div> </div>

View File

@ -1,14 +1,14 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<select class="form-select" id="page-parent" name="parent"> <select class="form-select" id="page-parent" name="parent">
<option value="." <?php if ($page->parent()->isSite()): ?> selected<?php endif ?>><?= $this->translate('panel.pages.newPage.site') ?> (/)</option> <option value="." <?php if ($page->parent()->isSite()) : ?> selected<?php endif ?>><?= $this->translate('panel.pages.newPage.site') ?> (/)</option>
<?php foreach ($parents as $parent): ?> <?php foreach ($parents as $parent) : ?>
<?php $scheme = $app->schemes()->get('pages.' . $parent->template()->name()) ?> <?php $scheme = $app->schemes()->get('pages.' . $parent->template()->name()) ?>
<?php if (!$scheme->options()->get('pages', true)): ?> <?php if (!$scheme->options()->get('pages', true)) : ?>
<?php continue ?> <?php continue ?>
<?php endif ?> <?php endif ?>
<?php if ($parent === $page): ?> <?php if ($parent === $page) : ?>
<?php continue ?> <?php continue ?>
<?php endif ?> <?php endif ?>
<option value="<?= $parent->route() ?>" <?php if ($page->parent() === $parent): ?> selected<?php endif ?>><?= str_repeat('— ', $parent->level() - 1) . $parent->title() ?></option> <option value="<?= $parent->route() ?>" <?php if ($page->parent() === $parent) : ?> selected<?php endif ?>><?= str_repeat('— ', $parent->level() - 1) . $parent->title() ?></option>
<?php endforeach ?> <?php endforeach ?>
</select> </select>

View File

@ -1,7 +1,7 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<select class="form-select" id="page-template" name="template"> <select class="form-select" id="page-template" name="template">
<?php foreach ($templates as $template): ?> <?php foreach ($templates as $template) : ?>
<?php $scheme = $app->schemes()->get('pages.' . $template) ?> <?php $scheme = $app->schemes()->get('pages.' . $template) ?>
<option value="<?= $template ?>" <?php if ($page->template()->name() === $template): ?> selected<?php endif ?>><?= $scheme->title() ?></option> <option value="<?= $template ?>" <?php if ($page->template()->name() === $template) : ?> selected<?php endif ?>><?= $scheme->title() ?></option>
<?php endforeach ?> <?php endforeach ?>
</select> </select>

View File

@ -1,3 +1,3 @@
<?php if ($field->has('label')): ?> <?php if ($field->has('label')) : ?>
<label class="form-label" for="<?= $field->name() ?>"><?= $field->label() ?></label> <label class="form-label" for="<?= $field->name() ?>"><?= $field->label() ?></label>
<?php endif ?> <?php endif ?>

View File

@ -1,16 +1,16 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<input <?= $this->attr([ <input <?= $this->attr([
'class' => 'form-input', 'class' => 'form-input',
'type' => 'password', 'type' => 'password',
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'value' => $field->value(), 'value' => $field->value(),
'placeholder' => $field->placeholder(), 'placeholder' => $field->placeholder(),
'minlength' => $field->get('min'), 'minlength' => $field->get('min'),
'maxlength' => $field->get('max'), 'maxlength' => $field->get('max'),
'pattern' => $field->get('pattern'), 'pattern' => $field->get('pattern'),
'autocomplete' => $field->get('autocomplete'), 'autocomplete' => $field->get('autocomplete'),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>

View File

@ -2,19 +2,19 @@
<div class="flex"> <div class="flex">
<div class="form-input-range"> <div class="form-input-range">
<input <?= $this->attr([ <input <?= $this->attr([
'class' => 'form-input', 'class' => 'form-input',
'type' => 'range', 'type' => 'range',
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'min' => $field->get('min'), 'min' => $field->get('min'),
'max' => $field->get('max'), 'max' => $field->get('max'),
'step' => $field->get('step'), 'step' => $field->get('step'),
'value' => $field->value(), 'value' => $field->value(),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
'data-ticks' => $field->get('ticks'), 'data-ticks' => $field->get('ticks'),
]) ?>> ]) ?>>
</div> </div>
<output class="form-input-range-value" for="<?= $field->name() ?>"><?= $field->value() ?></output> <output class="form-input-range-value" for="<?= $field->name() ?>"><?= $field->value() ?></output>
</div> </div>

View File

@ -1,13 +1,13 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<select <?= $this->attr([ <select <?= $this->attr([
'class' => 'form-select', 'class' => 'form-select',
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>
<?php foreach ($field->options() as $value => $label): ?> <?php foreach ($field->options() as $value => $label) : ?>
<option <?= $this->attr(['value' => $value, 'selected' => $value == $field->value()]) ?>><?= $label ?></option> <option <?= $this->attr(['value' => $value, 'selected' => $value == $field->value()]) ?>><?= $label ?></option>
<?php endforeach ?> <?php endforeach ?>
</select> </select>

View File

@ -1,9 +1,9 @@
<div class="tabs"> <div class="tabs">
<?php foreach ($field->get('fields') as $tab): ?> <?php foreach ($field->get('fields') as $tab) : ?>
<a <?= $this->attr([ <a <?= $this->attr([
'class' => ['tabs-tab', $tab->get('active') ? 'active' : ''], 'class' => ['tabs-tab', $tab->get('active') ? 'active' : ''],
'data-tab' => $tab->name(), 'data-tab' => $tab->name(),
]) ?>><?= $tab->label() ?></a> ]) ?>><?= $tab->label() ?></a>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
<?php $this->insert('fields', ['fields' => $field->get('fields')]) ?> <?php $this->insert('fields', ['fields' => $field->get('fields')]) ?>

View File

@ -1,14 +1,14 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<input <?= $this->attr([ <input <?= $this->attr([
'class' => 'form-input', 'class' => 'form-input',
'type' => 'text', 'type' => 'text',
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'value' => implode(', ', (array) $field->value()), 'value' => implode(', ', (array) $field->value()),
'placeholder' => $field->placeholder(), 'placeholder' => $field->placeholder(),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
'data-field' => 'tags', 'data-field' => 'tags',
'data-options' => $field->has('options') ? Formwork\Parsers\Json::encode((array) $field->get('options')) : null, 'data-options' => $field->has('options') ? Formwork\Parsers\Json::encode((array) $field->get('options')) : null,
]) ?>> ]) ?>>

View File

@ -1,15 +1,15 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<input <?= $this->attr([ <input <?= $this->attr([
'class' => ['form-input', $field->get('class')], 'class' => ['form-input', $field->get('class')],
'type' => 'text', 'type' => 'text',
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'value' => $field->value(), 'value' => $field->value(),
'placeholder' => $field->placeholder(), 'placeholder' => $field->placeholder(),
'minlength' => $field->get('min'), 'minlength' => $field->get('min'),
'maxlength' => $field->get('max'), 'maxlength' => $field->get('max'),
'pattern' => $field->get('pattern'), 'pattern' => $field->get('pattern'),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>

View File

@ -1,11 +1,11 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<textarea <?= $this->attr([ <textarea <?= $this->attr([
'class' => 'form-textarea', 'class' => 'form-textarea',
'id' => $field->name(), 'id' => $field->name(),
'name' => $field->formName(), 'name' => $field->formName(),
'placeholder' => $field->placeholder(), 'placeholder' => $field->placeholder(),
'rows' => $field->get('rows', 5), 'rows' => $field->get('rows', 5),
'required' => $field->isRequired(), 'required' => $field->isRequired(),
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>><?= $field->value() ?></textarea> ]) ?>><?= $field->value() ?></textarea>

View File

@ -1,22 +1,22 @@
<?php $this->layout('fields.field') ?> <?php $this->layout('fields.field') ?>
<div> <div>
<fieldset <?= $this->attr([ <fieldset <?= $this->attr([
'id' => $field->name(), 'id' => $field->name(),
'class' => 'form-togglegroup', 'class' => 'form-togglegroup',
'disabled' => $field->isDisabled(), 'disabled' => $field->isDisabled(),
'hidden' => $field->isHidden(), 'hidden' => $field->isHidden(),
]) ?>> ]) ?>>
<?php foreach ((array) $field->get('options') as $value => $label): ?> <?php foreach ((array) $field->get('options') as $value => $label) : ?>
<label class="form-label"> <label class="form-label">
<input <?= $this->attr([ <input <?= $this->attr([
'class' => 'form-input', 'class' => 'form-input',
'type' => 'radio', 'type' => 'radio',
'name' => $field->formName(), 'name' => $field->formName(),
'value' => $value, 'value' => $value,
'checked' => $value == $field->value(), 'checked' => $value == $field->value(),
]) ?>> ]) ?>>
<span><?= $label ?></span> <span><?= $label ?></span>
</label> </label>
<?php endforeach ?> <?php endforeach ?>
</fieldset> </fieldset>
</div> </div>

View File

@ -2,7 +2,7 @@
<html lang="<?= $app->translations()->getCurrent()->code() ?>"> <html lang="<?= $app->translations()->getCurrent()->code() ?>">
<head> <head>
<title><?php if (!empty($title)): ?><?= $title ?> | <?php endif ?>Formwork</title> <title><?php if (!empty($title)) : ?><?= $title ?> | <?php endif ?>Formwork</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
<link rel="icon" type="image/svg+xml" href="<?= $this->assets()->uri('images/icon.svg') ?>"> <link rel="icon" type="image/svg+xml" href="<?= $this->assets()->uri('images/icon.svg') ?>">
@ -14,7 +14,7 @@
<main> <main>
<div class="container-full"> <div class="container-full">
<div class="login-modal-container"> <div class="login-modal-container">
<?php if ($notification = $panel->notifications()): ?> <?php if ($notification = $panel->notifications()) : ?>
<div class="login-modal-<?= $notification[0]['type'] ?>"><?= $this->icon($notification[0]['icon']) ?> <?= $notification[0]['text'] ?></div> <div class="login-modal-<?= $notification[0]['type'] ?>"><?= $this->icon($notification[0]['icon']) ?> <?= $notification[0]['text'] ?></div>
<?php endif ?> <?php endif ?>
<?= $this->content() ?> <?= $this->content() ?>
@ -24,4 +24,4 @@
<?php $this->insert('partials.scripts') ?> <?php $this->insert('partials.scripts') ?>
</body> </body>
</html> </html>

View File

@ -11,4 +11,4 @@
<button type="button" class="button button-accent button-right" data-command="continue" data-href="#"><?= $this->icon('exclamation-circle') ?> <?= $this->translate('panel.pages.changes.continue') ?></button> <button type="button" class="button button-accent button-right" data-command="continue" data-href="#"><?= $this->icon('exclamation-circle') ?> <?= $this->translate('panel.pages.changes.continue') ?></button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -13,19 +13,19 @@
<label class="form-label form-label-required" for="page-parent"><?= $this->translate('panel.pages.newPage.parent') ?>:</label> <label class="form-label form-label-required" for="page-parent"><?= $this->translate('panel.pages.newPage.parent') ?>:</label>
<select class="form-select" id="page-parent" name="parent"> <select class="form-select" id="page-parent" name="parent">
<option value="." selected><?= $this->translate('panel.pages.newPage.site') ?> (/)</option> <option value="." selected><?= $this->translate('panel.pages.newPage.site') ?> (/)</option>
<?php foreach ($pages as $page): ?> <?php foreach ($pages as $page) : ?>
<?php $scheme = $app->schemes()->get('pages.' . $page->template()->name()) ?> <?php $scheme = $app->schemes()->get('pages.' . $page->template()->name()) ?>
<?php if (!$scheme->options()->get('children', true)): ?> <?php if (!$scheme->options()->get('children', true)) : ?>
<?php continue ?> <?php continue ?>
<?php endif ?> <?php endif ?>
<option value="<?= $page->route() ?>" <?php if ($scheme->options()->has('children.templates')): ?> data-allowed-templates="<?= implode(', ', $scheme->options()->get('children.templates')) ?>" <?php endif ?>><?= str_repeat('— ', $page->level() - 1) . $page->title() ?></option> <option value="<?= $page->route() ?>" <?php if ($scheme->options()->has('children.templates')) : ?> data-allowed-templates="<?= implode(', ', $scheme->options()->get('children.templates')) ?>" <?php endif ?>><?= str_repeat('— ', $page->level() - 1) . $page->title() ?></option>
<?php endforeach ?> <?php endforeach ?>
</select> </select>
<label class="form-label" form-label-required" for="page-template"><?= $this->translate('panel.pages.newPage.template') ?>:</label> <label class="form-label" form-label-required" for="page-template"><?= $this->translate('panel.pages.newPage.template') ?>:</label>
<select class="form-select" id="page-template" name="template"> <select class="form-select" id="page-template" name="template">
<?php foreach ($templates as $template): ?> <?php foreach ($templates as $template) : ?>
<?php $scheme = $app->schemes()->get('pages.' . $template) ?> <?php $scheme = $app->schemes()->get('pages.' . $template) ?>
<option value="<?= $template ?>" <?php if ($scheme->isDefault()): ?> selected<?php endif ?>><?= $scheme->title() ?></option> <option value="<?= $template ?>" <?php if ($scheme->isDefault()) : ?> selected<?php endif ?>><?= $scheme->title() ?></option>
<?php endforeach ?> <?php endforeach ?>
</select> </select>
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>"> <input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
@ -36,4 +36,4 @@
</div> </div>
</form> </form>
</div> </div>
</div> </div>

View File

@ -15,4 +15,4 @@
</div> </div>
</form> </form>
</div> </div>
</div> </div>

View File

@ -1,6 +1,8 @@
<div id="slugModal" class="modal" aria-labelledby="slugModalLabel"> <div id="slugModal" class="modal" aria-labelledby="slugModalLabel">
<div class="modal-container"> <div class="modal-container">
<div class="modal-header"><div class="caption" id="slugModalLabel"><?= $this->translate('panel.pages.changeSlug') ?></div></div> <div class="modal-header">
<div class="caption" id="slugModalLabel"><?= $this->translate('panel.pages.changeSlug') ?></div>
</div>
<div class="modal-content"> <div class="modal-content">
<label class="form-label" for="page-slug"><?= $this->translate('panel.pages.newPage.slug') ?>:</label> <label class="form-label" for="page-slug"><?= $this->translate('panel.pages.newPage.slug') ?>:</label>
<span class="form-label-suggestion">(<?= $this->translate('panel.pages.newPage.slugSuggestion') ?>)</span> <span class="form-label-suggestion">(<?= $this->translate('panel.pages.newPage.slugSuggestion') ?>)</span>
@ -12,4 +14,4 @@
<button type="button" class="button button-link button-right" data-command="generate-slug" title="<?= $this->translate('panel.pages.changeSlug.generate') ?>"><?= $this->icon('bolt') ?></button> <button type="button" class="button button-link button-right" data-command="generate-slug" title="<?= $this->translate('panel.pages.changeSlug.generate') ?>"><?= $this->icon('bolt') ?></button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -7,7 +7,7 @@
<?= $tabs ?> <?= $tabs ?>
<div> <div>
<?php foreach ($info as $section => $data): ?> <?php foreach ($info as $section => $data) : ?>
<section class="section collapsible"> <section class="section collapsible">
<div class="section-header"> <div class="section-header">
<button type="button" class="button section-toggle mr-2" title="<?= $this->translate('panel.sections.toggle') ?>" aria-label="<?= $this->translate('panel.sections.toggle') ?>"><?= $this->icon('chevron-up') ?></button> <button type="button" class="button section-toggle mr-2" title="<?= $this->translate('panel.sections.toggle') ?>" aria-label="<?= $this->translate('panel.sections.toggle') ?>"><?= $this->icon('chevron-up') ?></button>
@ -15,7 +15,7 @@
</div> </div>
<div class="section-content"> <div class="section-content">
<table class="table info-data"> <table class="table info-data">
<?php foreach ($data as $key => $value): ?> <?php foreach ($data as $key => $value) : ?>
<tr> <tr>
<td class="table-cell info-data-key"><?= $key ?></td> <td class="table-cell info-data-key"><?= $key ?></td>
<td class="table-cell info-data-value"><?= $value ?></td> <td class="table-cell info-data-value"><?= $value ?></td>
@ -25,4 +25,4 @@
</div> </div>
</section> </section>
<?php endforeach ?> <?php endforeach ?>
</div> </div>

View File

@ -12,4 +12,4 @@
<div> <div>
<?php $this->insert('fields', ['fields' => $fields]) ?> <?php $this->insert('fields', ['fields' => $fields]) ?>
</div> </div>
</form> </form>

View File

@ -12,5 +12,4 @@
<div> <div>
<?php $this->insert('fields', ['fields' => $fields]) ?> <?php $this->insert('fields', ['fields' => $fields]) ?>
</div> </div>
</form> </form>

View File

@ -1,7 +1,7 @@
<div class="tabs"> <div class="tabs">
<?php foreach ($tabs as $tab): ?> <?php foreach ($tabs as $tab) : ?>
<?php if ($panel->user()->permissions()->has('options.' . $tab)): ?> <?php if ($panel->user()->permissions()->has('options.' . $tab)) : ?>
<a class="tabs-tab<?= ($tab === $current) ? ' active' : '' ?>" href="<?= $panel->uri('/options/' . $tab . '/') ?>"><?= $this->translate('panel.options.' . $tab) ?></a> <a class="tabs-tab<?= ($tab === $current) ? ' active' : '' ?>" href="<?= $panel->uri('/options/' . $tab . '/') ?>"><?= $this->translate('panel.options.' . $tab) ?></a>
<?php endif ?> <?php endif ?>
<?php endforeach ?> <?php endforeach ?>
</div> </div>

View File

@ -5,29 +5,29 @@
<div class="header-title"><?= $this->icon($page->get('icon', 'page')) ?> <?= $page->title() ?></div> <div class="header-title"><?= $this->icon($page->get('icon', 'page')) ?> <?= $page->title() ?></div>
<div class="flex"> <div class="flex">
<div class="page-status-<?= $page->status() ?> mr-2"><?= $this->icon('circle-small-fill') ?></div> <div class="page-status-<?= $page->status() ?> mr-2"><?= $this->icon('circle-small-fill') ?></div>
<?php if (!$page->isIndexPage() && !$page->isErrorPage()): ?> <?php if (!$page->isIndexPage() && !$page->isErrorPage()) : ?>
<div class="page-route page-route-changeable min-w-0"> <div class="page-route page-route-changeable min-w-0">
<button type="button" class="button page-slug-change truncate max-w-100" data-command="change-slug" title="<?= $this->translate('panel.pages.changeSlug') ?>"><span class="page-route-inner"><?= $page->route() ?></span> <?= $this->icon('pencil') ?></button> <button type="button" class="button page-slug-change truncate max-w-100" data-command="change-slug" title="<?= $this->translate('panel.pages.changeSlug') ?>"><span class="page-route-inner"><?= $page->route() ?></span> <?= $this->icon('pencil') ?></button>
</div> </div>
<?php else: ?> <?php else : ?>
<div class="page-route"><?= $page->route() ?></div> <div class="page-route"><?= $page->route() ?></div>
<?php endif ?> <?php endif ?>
</div> </div>
</div> </div>
<input type="hidden" id="slug" name="slug" value="<?= $page->slug() ?>"> <input type="hidden" id="slug" name="slug" value="<?= $page->slug() ?>">
<?php if ($currentLanguage): ?> <?php if ($currentLanguage) : ?>
<input type="hidden" id="language" name="language" value="<?= $currentLanguage ?>"> <input type="hidden" id="language" name="language" value="<?= $currentLanguage ?>">
<?php endif ?> <?php endif ?>
<div> <div>
<a class="button button-link<?php if (!$page->published() || !$page->routable()): ?> disabled<?php endif ?>" role="button" <?php if ($page->published() && $page->routable()): ?>href="<?= $page->uri(includeLanguage: $currentLanguage ?: true) ?>" <?php endif ?> target="formwork-preview-<?= $page->uid() ?>" title="<?= $this->translate('panel.pages.preview') ?>" aria-label="<?= $this->translate('panel.pages.preview') ?>"><?= $this->icon('eye') ?></a> <a class="button button-link<?php if (!$page->published() || !$page->routable()) : ?> disabled<?php endif ?>" role="button" <?php if ($page->published() && $page->routable()) : ?>href="<?= $page->uri(includeLanguage: $currentLanguage ?: true) ?>" <?php endif ?> target="formwork-preview-<?= $page->uid() ?>" title="<?= $this->translate('panel.pages.preview') ?>" aria-label="<?= $this->translate('panel.pages.preview') ?>"><?= $this->icon('eye') ?></a>
<?php if ($panel->user()->permissions()->has('pages.delete')): ?> <?php if ($panel->user()->permissions()->has('pages.delete')) : ?>
<button type="button" class="button button-link" data-modal="deletePageModal" data-modal-action="<?= $panel->uri('/pages/' . trim($page->route(), '/') . '/delete/' . ($currentLanguage ? 'language/' . $currentLanguage . '/' : '')) ?>" title="<?= $this->translate('panel.pages.deletePage') ?>" aria-label="<?= $this->translate('panel.pages.deletePage') ?>" <?php if (!$page->isDeletable()): ?> disabled<?php endif ?>><?= $this->icon('trash') ?></button> <button type="button" class="button button-link" data-modal="deletePageModal" data-modal-action="<?= $panel->uri('/pages/' . trim($page->route(), '/') . '/delete/' . ($currentLanguage ? 'language/' . $currentLanguage . '/' : '')) ?>" title="<?= $this->translate('panel.pages.deletePage') ?>" aria-label="<?= $this->translate('panel.pages.deletePage') ?>" <?php if (!$page->isDeletable()) : ?> disabled<?php endif ?>><?= $this->icon('trash') ?></button>
<?php endif ?> <?php endif ?>
<?php if (!$site->languages()->available()->isEmpty()): ?> <?php if (!$site->languages()->available()->isEmpty()) : ?>
<div class="dropdown"> <div class="dropdown">
<button type="button" class="button dropdown-button caret button-accent" data-dropdown="languages-dropdown"><?= $this->icon('translate') ?> <?= $this->translate('panel.pages.languages') ?><?php if ($currentLanguage): ?> <span class="badge"><?= $currentLanguage ?></span><?php endif ?></button> <button type="button" class="button dropdown-button caret button-accent" data-dropdown="languages-dropdown"><?= $this->icon('translate') ?> <?= $this->translate('panel.pages.languages') ?><?php if ($currentLanguage) : ?> <span class="badge"><?= $currentLanguage ?></span><?php endif ?></button>
<div class="dropdown-menu" id="languages-dropdown"> <div class="dropdown-menu" id="languages-dropdown">
<?php foreach ($site->languages()->available() as $language): ?> <?php foreach ($site->languages()->available() as $language) : ?>
<a href="<?= $panel->uri('/pages/' . trim($page->route(), '/') . '/edit/language/' . $language . '/') ?>" class="dropdown-item"><?= $page->languages()->available()->has($language) ? $this->translate('panel.pages.languages.editLanguage', $language->nativeName() . ' (' . $language->code() . ')') : $this->translate('panel.pages.languages.editLanguage', $language->nativeName() . ' (' . $language->code() . ')') ?></a> <a href="<?= $panel->uri('/pages/' . trim($page->route(), '/') . '/edit/language/' . $language . '/') ?>" class="dropdown-item"><?= $page->languages()->available()->has($language) ? $this->translate('panel.pages.languages.editLanguage', $language->nativeName() . ' (' . $language->code() . ')') : $this->translate('panel.pages.languages.editLanguage', $language->nativeName() . ' (' . $language->code() . ')') ?></a>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
@ -40,4 +40,4 @@
<?php $this->insert('fields', ['fields' => $fields]) ?> <?php $this->insert('fields', ['fields' => $fields]) ?>
</div> </div>
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>"> <input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
</form> </form>

View File

@ -3,7 +3,7 @@
<div class="header"> <div class="header">
<div class="header-title"><?= $this->translate('panel.pages.pages') ?> <span class="badge"><?= $app->site()->descendants()->count() ?></span></div> <div class="header-title"><?= $this->translate('panel.pages.pages') ?> <span class="badge"><?= $app->site()->descendants()->count() ?></span></div>
<div> <div>
<?php if ($panel->user()->permissions()->has('pages.create')): ?> <?php if ($panel->user()->permissions()->has('pages.create')) : ?>
<button type="button" class="button button-accent" data-modal="newPageModal"><?= $this->icon('plus-circle') ?> <?= $this->translate('panel.pages.newPage') ?></button> <button type="button" class="button button-accent" data-modal="newPageModal"><?= $this->icon('plus-circle') ?> <?= $this->translate('panel.pages.newPage') ?></button>
<?php endif ?> <?php endif ?>
</div> </div>
@ -21,4 +21,4 @@
</div> </div>
</div> </div>
<?= $pagesTree ?> <?= $pagesTree ?>
</section> </section>

View File

@ -1,2 +1,4 @@
<script src="<?= $this->assets()->uri('js/app.min.js', true) ?>" integrity="<?= $this->assets()->integrityHash('js/app.min.js') ?>"></script> <script src="<?= $this->assets()->uri('js/app.min.js', true) ?>" integrity="<?= $this->assets()->integrityHash('js/app.min.js') ?>"></script>
<script>Formwork.app.load(<?= $appConfig ?>);</script> <script>
Formwork.app.load(<?= $appConfig ?>);
</script>

View File

@ -14,10 +14,10 @@
<input class="form-input" id="email" type="email" required name="email"> <input class="form-input" id="email" type="email" required name="email">
<label class="form-label form-label-required" for="email"><?= $this->translate('panel.user.language') ?>:</label> <label class="form-label form-label-required" for="email"><?= $this->translate('panel.user.language') ?>:</label>
<select class="form-select" id="language" name="language"> <select class="form-select" id="language" name="language">
<?php foreach ($panel->availableTranslations() as $key => $value): ?> <?php foreach ($panel->availableTranslations() as $key => $value) : ?>
<option value="<?= $key ?>" <?php if ($key === $app->config()->get('system.panel.translation')): ?> selected<?php endif ?>><?= $value ?></option> <option value="<?= $key ?>" <?php if ($key === $app->config()->get('system.panel.translation')) : ?> selected<?php endif ?>><?= $value ?></option>
<?php endforeach ?> <?php endforeach ?>
</select> </select>
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>"> <input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
<button type="submit" class="button button-accent mt-8"><?= $this->icon('check-circle') ?> <?= $this->translate('panel.modal.action.continue') ?></button> <button type="submit" class="button button-accent mt-8"><?= $this->icon('check-circle') ?> <?= $this->translate('panel.modal.action.continue') ?></button>
</form> </form>

View File

@ -1,7 +1,7 @@
<div class="tabs"> <div class="tabs">
<?php foreach ($tabs as $tab): ?> <?php foreach ($tabs as $tab) : ?>
<?php if ($panel->user()->permissions()->has('tools.' . $tab)): ?> <?php if ($panel->user()->permissions()->has('tools.' . $tab)) : ?>
<a class="tabs-tab<?= ($tab === $current) ? ' active' : '' ?>" href="<?= $panel->uri('/tools/' . $tab . '/') ?>"><?= $this->translate('panel.tools.' . $tab) ?></a> <a class="tabs-tab<?= ($tab === $current) ? ' active' : '' ?>" href="<?= $panel->uri('/tools/' . $tab . '/') ?>"><?= $this->translate('panel.tools.' . $tab) ?></a>
<?php endif ?> <?php endif ?>
<?php endforeach ?> <?php endforeach ?>
</div> </div>

View File

@ -4,7 +4,7 @@
<div class="header"> <div class="header">
<div class="header-title"><?= $this->translate('panel.users.user') ?></div> <div class="header-title"><?= $this->translate('panel.users.user') ?></div>
<div> <div>
<button type="button" class="button button-link" data-modal="deleteUserModal" data-modal-action="<?= $panel->uri('/users/' . $user->username() . '/delete/') ?>" title="<?= $this->translate('panel.users.deleteUser') ?>" aria-label="<?= $this->translate('panel.users.deleteUser') ?>" <?php if (!$panel->user()->canDeleteUser($user)): ?>disabled<?php endif ?>><?= $this->icon('trash') ?></button> <button type="button" class="button button-link" data-modal="deleteUserModal" data-modal-action="<?= $panel->uri('/users/' . $user->username() . '/delete/') ?>" title="<?= $this->translate('panel.users.deleteUser') ?>" aria-label="<?= $this->translate('panel.users.deleteUser') ?>" <?php if (!$panel->user()->canDeleteUser($user)) : ?>disabled<?php endif ?>><?= $this->icon('trash') ?></button>
<button type="submit" class="button button-accent" data-command="save"><?= $this->icon('check-circle') ?> <?= $this->translate('panel.modal.action.save') ?></button> <button type="submit" class="button button-accent" data-command="save"><?= $this->icon('check-circle') ?> <?= $this->translate('panel.modal.action.save') ?></button>
</div> </div>
</div> </div>
@ -22,8 +22,8 @@
</div> </div>
</div> </div>
</section> </section>
<?php if ($panel->user()->canChangeOptionsOf($user)): ?> <?php if ($panel->user()->canChangeOptionsOf($user)) : ?>
<?php $this->insert('fields', ['fields' => $fields]) ?> <?php $this->insert('fields', ['fields' => $fields]) ?>
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>"> <input type="hidden" name="csrf-token" value="<?= $csrfToken ?>">
<?php endif ?> <?php endif ?>
</form> </form>

View File

@ -1,26 +1,26 @@
<?= $this->layout('site') ?> <?= $this->layout('site') ?>
<?php if ($page->content()): ?> <?php if ($page->content()) : ?>
<aside> <aside>
<div class="container"> <div class="container">
<?= $page->content() ?> <?= $page->content() ?>
</div> </div>
</aside> </aside>
<?php endif ?> <?php endif ?>
<main> <main>
<div class="container"> <div class="container">
<?php foreach ($posts as $post): ?> <?php foreach ($posts as $post) : ?>
<article> <article>
<h1 class="article-title"><a href="<?= $post->uri() ?>"><?= $post->title() ?></a></h1> <h1 class="article-title"><a href="<?= $post->uri() ?>"><?= $post->title() ?></a></h1>
<?php if (!$post->publishDate()->isEmpty()): ?><div style="font-size: 0.875rem; color: #aaa;"><?= $post->publishDate()->toDuration() ?></div><?php endif ?> <?php if (!$post->publishDate()->isEmpty()) : ?><div style="font-size: 0.875rem; color: #aaa;"><?= $post->publishDate()->toDuration() ?></div><?php endif ?>
<?= $this->insert('_tags', ['post' => $post, 'blog' => $page]) ?> <?= $this->insert('_tags', ['post' => $post, 'blog' => $page]) ?>
<?php if (!$post->summary()->isEmpty()): ?> <?php if (!$post->summary()->isEmpty()) : ?>
<?= $post->summary() ?> <?= $post->summary() ?>
<a class="read-more" href="<?= $post->uri() ?>" rel="bookmark">Read more &rarr;</a> <a class="read-more" href="<?= $post->uri() ?>" rel="bookmark">Read more &rarr;</a>
<?php else: ?> <?php else : ?>
<?= $post->content() ?> <?= $post->content() ?>
<?php endif ?> <?php endif ?>
</article> </article>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
</main> </main>
<?= $this->insert('_pagination') ?> <?= $this->insert('_pagination') ?>

View File

@ -5,7 +5,8 @@ $posts = $page->children()->published();
// If the route has the param `{tagName}` // If the route has the param `{tagName}`
if ($router->params()->has('tagName')) { if ($router->params()->has('tagName')) {
$posts = $posts->filterBy('tags', // Filter posts by tags... $posts = $posts->filterBy(
'tags', // Filter posts by tags...
fn ($tags) => $tags fn ($tags) => $tags
->map(fn ($tag) => $this->slug($tag)) // where the collection of their slugs... ->map(fn ($tag) => $this->slug($tag)) // where the collection of their slugs...
->contains($router->params()->get('tagName')) // contains the value of the `tagName` param. ->contains($router->params()->get('tagName')) // contains the value of the `tagName` param.

View File

@ -4,4 +4,4 @@
<h1><?= $page->title() ?></h1> <h1><?= $page->title() ?></h1>
<?= $page->content() ?> <?= $page->content() ?>
</div> </div>
</main> </main>

View File

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?= $site->languages()->current() ?>"> <html lang="<?= $site->languages()->current() ?>">
<head> <head>
<title><?= $page->title() ?> | <?= $site->title() ?></title> <title><?= $page->title() ?> | <?= $site->title() ?></title>
<?= $this->insert('_meta') ?> <?= $this->insert('_meta') ?>
@ -7,14 +8,16 @@
<link rel="stylesheet" type="text/css" href="<?= $this->assets()->uri('css/style.min.css') ?>"> <link rel="stylesheet" type="text/css" href="<?= $this->assets()->uri('css/style.min.css') ?>">
<script src="<?= $this->assets()->uri('js/script.min.js') ?>"></script> <script src="<?= $this->assets()->uri('js/script.min.js') ?>"></script>
</head> </head>
<body> <body>
<?= $this->insert('_menu') ?> <?= $this->insert('_menu') ?>
<?= $this->insert('_cover-image') ?> <?= $this->insert('_cover-image') ?>
<?= $this->content() ?> <?= $this->content() ?>
<footer> <footer>
<div class="container small"> <div class="container small">
&copy; 2017-2021 &mdash; Made with <a href="https://github.com/getformwork/formwork">Formwork</a> &copy; 2017-2021 &mdash; Made with <a href="https://github.com/getformwork/formwork">Formwork</a>
</div> </div>
</footer> </footer>
</body> </body>
</html>
</html>

View File

@ -5,4 +5,4 @@
<?= $page->content() ?> <?= $page->content() ?>
</article> </article>
</div> </div>
</main> </main>

View File

@ -1,3 +1,3 @@
<?php if ($page->has('image') && !$page->image()->isEmpty() && $page->images()->has($page->image())): ?> <?php if ($page->has('image') && !$page->image()->isEmpty() && $page->images()->has($page->image())) : ?>
<div class="cover-image" style="background-image:url(<?= $page->uri($page->image()) ?>);"></div> <div class="cover-image" style="background-image:url(<?= $page->uri($page->image()) ?>);"></div>
<?php endif ?> <?php endif ?>

View File

@ -3,9 +3,9 @@
<a class="menu-header" href="<?= $site->uri() ?>"><?= $site->title() ?></a> <a class="menu-header" href="<?= $site->uri() ?>"><?= $site->title() ?></a>
<button type="button" class="button menu-toggle" data-toggle="main-menu" aria-expanded="false">&#9776;</button> <button type="button" class="button menu-toggle" data-toggle="main-menu" aria-expanded="false">&#9776;</button>
<div class="menu-list menu-collapse" id="main-menu"> <div class="menu-list menu-collapse" id="main-menu">
<?php foreach ($site->children()->published()->listed() as $item): ?> <?php foreach ($site->children()->published()->listed() as $item) : ?>
<a class="menu-item<?php if ($item->isCurrent()): ?> active<?php endif ?>" href="<?= $item->uri() ?>"><?= $item->get('menu', $item->title()) ?></a> <a class="menu-item<?php if ($item->isCurrent()) : ?> active<?php endif ?>" href="<?= $item->uri() ?>"><?= $item->get('menu', $item->title()) ?></a>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
</div> </div>
</nav> </nav>

View File

@ -1,9 +1,9 @@
<?php foreach ($page->metadata() as $meta): ?> <?php foreach ($page->metadata() as $meta) : ?>
<?php if ($meta->isCharset()): ?> <?php if ($meta->isCharset()) : ?>
<meta charset="<?= $meta->content() ?>"> <meta charset="<?= $meta->content() ?>">
<?php elseif ($meta->isHTTPEquiv()): ?> <?php elseif ($meta->isHTTPEquiv()) : ?>
<meta http-equiv="<?= $meta->name() ?>" content="<?= $meta->content() ?>"> <meta http-equiv="<?= $meta->name() ?>" content="<?= $meta->content() ?>">
<?php else: ?> <?php else : ?>
<meta <?= $meta->prefix() === 'og' ? 'property' : 'name' ?>="<?= $meta->name() ?>" content="<?= $meta->content() ?>"> <meta <?= $meta->prefix() === 'og' ? 'property' : 'name' ?>="<?= $meta->name() ?>" content="<?= $meta->content() ?>">
<?php endif ?> <?php endif ?>
<?php endforeach ?> <?php endforeach ?>

View File

@ -1,14 +1,14 @@
<?php if ($pagination->hasPages()): ?> <?php if ($pagination->hasPages()) : ?>
<nav class="pagination"> <nav class="pagination">
<?php if ($pagination->hasPreviousPage()): ?> <?php if ($pagination->hasPreviousPage()) : ?>
<a class="pagination-previous" href="<?= $pagination->previousPageUri() ?>" rel="prev">&larr; Previous</a> <a class="pagination-previous" href="<?= $pagination->previousPageUri() ?>" rel="prev">&larr; Previous</a>
<?php else: ?> <?php else : ?>
<a class="pagination-previous disabled">&larr; Previous</a> <a class="pagination-previous disabled">&larr; Previous</a>
<?php endif ?> <?php endif ?>
<?php if ($pagination->hasNextPage()): ?> <?php if ($pagination->hasNextPage()) : ?>
<a class="pagination-next" href="<?= $pagination->nextPageUri() ?>" rel="next">Next &rarr;</a> <a class="pagination-next" href="<?= $pagination->nextPageUri() ?>" rel="next">Next &rarr;</a>
<?php else: ?> <?php else : ?>
<a class="pagination-next disabled">Next &rarr;</a> <a class="pagination-next disabled">Next &rarr;</a>
<?php endif ?> <?php endif ?>
</nav> </nav>
<?php endif ?> <?php endif ?>

View File

@ -1,7 +1,7 @@
<?php if ($post->has('tags')): ?> <?php if ($post->has('tags')) : ?>
<div class="tags"> <div class="tags">
<?php foreach ($post->tags() as $tag): ?> <?php foreach ($post->tags() as $tag) : ?>
<a class="tag" rel="tag" href="<?= $blog->uri('/tag/' . $this->slug($tag) . '/') ?>"><?= $tag ?></a> <a class="tag" rel="tag" href="<?= $blog->uri('/tag/' . $this->slug($tag) . '/') ?>"><?= $tag ?></a>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
<?php endif ?> <?php endif ?>

View File

@ -7,4 +7,4 @@
<?= $page->summary() ?><?= $page->content() ?> <?= $page->summary() ?><?= $page->content() ?>
</article> </article>
</div> </div>
</main> </main>