webp
This commit is contained in:
parent
068492e495
commit
53a2ed8b0f
11 changed files with 29 additions and 21 deletions
|
|
@ -42,7 +42,7 @@ class FileVersion
|
|||
// asset method proxy
|
||||
if (method_exists($this->asset(), $method)) {
|
||||
if ($this->exists() === false) {
|
||||
$this->save();
|
||||
$this;
|
||||
}
|
||||
|
||||
return $this->asset()->$method(...$arguments);
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ class Language
|
|||
// validate the new language
|
||||
LanguageRules::create($language);
|
||||
|
||||
$language->save();
|
||||
$language;
|
||||
|
||||
if ($languages->count() === 0) {
|
||||
foreach ($kirby->models() as $model) {
|
||||
|
|
@ -549,7 +549,7 @@ class Language
|
|||
// if language just got promoted to be the new default language…
|
||||
if ($this->isDefault() === false && $updated->isDefault() === true) {
|
||||
// convert the current default to a non-default language
|
||||
$previous = $kirby->defaultLanguage()?->clone(['default' => false])->save();
|
||||
$previous = $kirby->defaultLanguage()?->clone(['default' => false]);
|
||||
$kirby->languages(false)->set($previous->code(), $previous);
|
||||
|
||||
foreach ($kirby->models() as $model) {
|
||||
|
|
@ -567,7 +567,7 @@ class Language
|
|||
throw new LogicException('Please select another language to be the primary language');
|
||||
}
|
||||
|
||||
$language = $updated->save();
|
||||
$language = $updated;
|
||||
|
||||
// make sure the language is also updated in the languages collection
|
||||
$kirby->languages(false)->set($language->code(), $language);
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ class License
|
|||
unset($this->status, $this->type);
|
||||
|
||||
// save the new state of the license
|
||||
$this->save();
|
||||
$this;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ class Field extends Component
|
|||
{
|
||||
// check simple conditions first
|
||||
if (
|
||||
$this->save() === false ||
|
||||
$this === false ||
|
||||
$this->isRequired() === false ||
|
||||
$this->isEmpty() === false
|
||||
) {
|
||||
|
|
@ -442,7 +442,7 @@ class Field extends Component
|
|||
unset($array['model']);
|
||||
|
||||
$array['hidden'] = $this->isHidden();
|
||||
$array['saveable'] = $this->save();
|
||||
$array['saveable'] = $this;
|
||||
$array['signature'] = md5(json_encode($array));
|
||||
|
||||
ksort($array);
|
||||
|
|
@ -505,6 +505,6 @@ class Field extends Component
|
|||
*/
|
||||
public function value(): mixed
|
||||
{
|
||||
return $this->save() ? $this->value : null;
|
||||
return $this ? $this->value : null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class Form
|
|||
$field = static::exceptionField($e, $props);
|
||||
}
|
||||
|
||||
if ($field->save() !== false) {
|
||||
if ($field !== false) {
|
||||
$this->values[$name] = $field->value();
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ class Form
|
|||
$data = $this->values;
|
||||
|
||||
foreach ($this->fields as $field) {
|
||||
if ($field->save() === false || $field->unset() === true) {
|
||||
if ($field === false || $field->unset() === true) {
|
||||
if ($includeNulls === true) {
|
||||
$data[$field->name()] = null;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ class Validations
|
|||
{
|
||||
if (
|
||||
$field->isRequired() === true &&
|
||||
$field->save() === true &&
|
||||
$field === true &&
|
||||
$field->isEmpty($value) === true
|
||||
) {
|
||||
throw new InvalidArgumentException([
|
||||
|
|
|
|||
|
|
@ -13,7 +13,15 @@ return [
|
|||
'format' => 'webp'
|
||||
],
|
||||
'srcsets' => [
|
||||
'default' => [200, 400, 600, 800, 1024, 1440, 2048],
|
||||
'default' => [
|
||||
['width' => 200, 'format' => 'webp'],
|
||||
['width' => 400, 'format' => 'webp'],
|
||||
['width' => 600, 'format' => 'webp'],
|
||||
['width' => 800, 'format' => 'webp'],
|
||||
['width' => 1024, 'format' => 'webp'],
|
||||
['width' => 1440, 'format' => 'webp'],
|
||||
['width' => 2048, 'format' => 'webp']
|
||||
],
|
||||
],
|
||||
],
|
||||
'panel' => [
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
<div class="image-wrapper">
|
||||
<?php if ($event->gallery()->toFiles()->count() > 1): ?>
|
||||
<?php snippet('picture', [
|
||||
'file' => $event->gallery()->toFiles()->first()->thumb('grid'),
|
||||
'file' => $event->gallery()->toFiles()->first()->thumb(),
|
||||
'class' => 'image-cover',
|
||||
'size' => (100 / (12 / $span) - 10)
|
||||
]) ?>
|
||||
<?php endif ?>
|
||||
<?php
|
||||
$file = $event->gallery()->toFiles()->count() > 1 ? $event->gallery()->toFiles()->nth(1) : $event->gallery()->toFiles()->first();
|
||||
snippet('picture', ["file" => $file, 'size' => (100 / (12 / $span) - 10), 'alt' => null]);
|
||||
snippet('picture', ["file" => $file->thumb(), 'size' => (100 / (12 / $span) - 10), 'alt' => null]);
|
||||
?>
|
||||
</div>
|
||||
<div class="event-card__infos">
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
$alt = $alt ?? $file->alt();
|
||||
$crop = $crop ?? false;
|
||||
|
||||
$webPSrcset = $crop === 'banner' ? $file->crop(1600, 800)->srcset('webp') : $file->srcset('webp');
|
||||
$srcset = $crop === 'banner' ? $file->crop(1600, 800)->srcset() : $file->srcset();
|
||||
$src = $crop === 'banner' ? $file->crop(1600, 800)->url() : $file->url();
|
||||
$width = $crop === 'banner' ? $file->crop(1600, 800)->width() : $file->resize(1800)->width();
|
||||
$height = $crop === 'banner' ? $file->crop(1600, 800)->height() : $file->resize(1800)->height();
|
||||
$webPSrcset = $file->srcset('webp');
|
||||
$srcset = $file->srcset();
|
||||
$src = $file->url();
|
||||
$width = $file->resize(1800)->width();
|
||||
$height = $file->resize(1800)->height();
|
||||
$class = isset($class) ? 'class="' . $class . '"': '';
|
||||
$lazy = $lazy ?? true;
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<div class="hero__image" style="--color: var(--color-season)">
|
||||
<?php if ($site->heroLinkUrl()->isNotEmpty() == 'true'): ?>
|
||||
<a href="<?= $site->heroLinkUrl()->toUrl() ?>" title="en savoir plus">
|
||||
<?php snippet('picture', ['file' => $site->heroImage()->toFile(), 'lazy' => false, 'size' => 50]) ?>
|
||||
<?php snippet('picture', ['file' => $site->heroImage()->toFile()->thumb(), 'lazy' => false, 'size' => 50]) ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<?php snippet('picture', ['file' => $site->heroImage()->toFile()->thumb(), 'lazy' => false, 'size' => 50]) ?>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class SessionCookieJar extends CookieJar
|
|||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->save();
|
||||
$this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue