From 12c6692ffa75bbbbb8f49898a76711bdfa607ae0 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 10 Feb 2026 19:50:46 +0100 Subject: [PATCH] wip #7868 @2 --- app/Fields/ShortLinkFluidbooks.php | 13 +++++++++ app/Models/LinkShortener.php | 2 +- app/Models/ShortLink.php | 7 +++-- .../fields/shortlinks_fluidbooks.blade.php | 29 +++++++++++++++++++ 4 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 app/Fields/ShortLinkFluidbooks.php create mode 100644 resources/views/fields/shortlinks_fluidbooks.blade.php diff --git a/app/Fields/ShortLinkFluidbooks.php b/app/Fields/ShortLinkFluidbooks.php new file mode 100644 index 000000000..83f29a502 --- /dev/null +++ b/app/Fields/ShortLinkFluidbooks.php @@ -0,0 +1,13 @@ +shorturl) { + if (isset($res->shorturl) && $res->shorturl) { return $res->shorturl; } }); diff --git a/app/Models/ShortLink.php b/app/Models/ShortLink.php index 7d1f10fe2..79466622a 100644 --- a/app/Models/ShortLink.php +++ b/app/Models/ShortLink.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Fields\ShortLinkFluidbooks; use App\Models\Base\ToolboxModel; use Cubist\Backpack\CubistBackpackServiceProvider; use Cubist\Backpack\Magic\Fields\Hidden; @@ -43,11 +44,11 @@ class ShortLink extends ToolboxModel $this->addField('server', SelectFromArray::class, __('Serveur'), ['type' => 'hidden', 'options' => LinkShortener::getAvaiableShorteners()]); $this->addField('url', URL::class, __('URL'), ['column' => true]); $this->addField('shortlink', URL::class, __('URL courte'), ['type' => 'hidden_visible', 'column' => true, 'column_view_namespace' => CubistBackpackServiceProvider::NAMESPACE . '::columns', 'column_type' => 'url', 'database_unique' => true]); - $this->addField('http_code', Integer::class, __('Code HTTP'), ['type' => 'hidden_visible', 'column' => true, 'column_label' => '', 'column_type' => 'http_code', 'column_view_namespace' => 'columns']); + $this->addField('http_code', Integer::class, __('Code HTTP'), ['type' => 'hidden_visible', 'column' => true, 'column_label' => '', 'column_type' => 'http_code', 'column_view_namespace' => 'columns']); $this->addField('code_date', \Cubist\Backpack\Magic\Fields\Datetime::class, __('Code observé le'), ['type' => 'hidden_visible', 'column' => true]); - $this->addField('target_code', Integer::class, __('Code final'), ['type' => 'hidden_visible', 'column' => true, 'column_type' => 'http_code', 'column_view_namespace' => 'columns','column_label' => '']); + $this->addField('target_code', Integer::class, __('Code final'), ['type' => 'hidden_visible', 'column' => true, 'column_type' => 'http_code', 'column_view_namespace' => 'columns', 'column_label' => '']); $this->addField('target_url', URL::class, __('URL finale'), ['type' => 'hidden_visible', 'column' => true, 'column_view_namespace' => CubistBackpackServiceProvider::NAMESPACE . '::columns', 'column_type' => 'url', 'column_limit' => 40]); - $this->addField('fluidbook_links', Textarea::class, __('Présence dans les fluidbooks'), ['type' => 'hidden_visible', 'column_label' => '','column' => true, 'column_type' => 'shortlinks_fluidbooks', 'column_view_namespace' => 'columns']); + $this->addField('fluidbook_links', ShortLinkFluidbooks::class, __('Présence dans les fluidbooks'), ['column_label' => '', 'column' => true]); $this->addOwnerField(['column' => false, 'type' => Hidden::class]); } diff --git a/resources/views/fields/shortlinks_fluidbooks.blade.php b/resources/views/fields/shortlinks_fluidbooks.blade.php new file mode 100644 index 000000000..6c2db5832 --- /dev/null +++ b/resources/views/fields/shortlinks_fluidbooks.blade.php @@ -0,0 +1,29 @@ +@php + + $value=old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? ''; +@endphp + +@include('crud::fields.inc.wrapper_start') + +@include('crud::fields.inc.translatable_icon') + + +{{-- HINT --}} + +@include('crud::fields.inc.wrapper_end') + -- 2.39.5