public function handle()
{
- Artisan::call('config:cache');
+
+
$items = config('backpack.menu.items');
$res = '';
--- /dev/null
+<?php
+
+namespace Cubist\Backpack\Console\Commands;
+
+class OptimizeClearCommand extends \Illuminate\Foundation\Console\OptimizeClearCommand
+{
+ public function handle()
+ {
+ parent::handle();
+
+ collect([
+ 'menu' => fn() => $this->callSilent('cubist:menu:generate') == 0,
+ ])->each(fn($task, $description) => $this->components->task($description, $task));
+
+ $this->newLine();
+ }
+}
use Cubist\Backpack\Console\Commands\InstallCommand;
use Cubist\Backpack\Console\Commands\LocaleCopy;
use Cubist\Backpack\Console\Commands\LocaleSlugReset;
+use Cubist\Backpack\Console\Commands\OptimizeClearCommand;
use Cubist\Backpack\Console\Commands\PrecacheCommand;
use Cubist\Backpack\Console\Commands\RefreshComposedAttributesCommand;
use Cubist\Backpack\Console\Commands\SearchIndexCommand;
RefreshComposedAttributesCommand::class,
SearchIndexCommand::class,
LocaleCopy::class,
- LocaleSlugReset::class
+ LocaleSlugReset::class,
+ OptimizeClearCommand::class,
]);
+
}
public function provides()
protected $_allowNull = false;
protected $_translatable = false;
- protected function _postSetAttributes()
+ public function getOptions()
{
- parent::_postSetAttributes();
$templates = TemplateAbstract::getTemplates();
$options = [];
foreach ($templates as $name => $template) {
$options[Str::snake($name)] = $template->getName();
}
- $this->setAttribute('options', $options);
+ return $options;
}
}
}
- public function onCreating():bool
+ public function onCreating(): bool
{
$this->useTemplateIfNotSet(request('template'));
return $this->onCreating();
// parent::onBeforeEdit($controller, $id);
// }
- public function onSaving():bool
+ public function onSaving(): bool
{
$this->useTemplateIfNotSet(request('template'));
return $this->onSaving();
}
- public function onUpdating():bool
+ public function onUpdating(): bool
{
$this->useTemplateIfNotSet(request('template'));
return $this->onUpdating();
}
}
+
public function create(array $attributes = [])
{
+ if (!isset($attributes['template']) || !$attributes['template']) {
+ $attributes['template']='unset';
+ }
$this->useTemplate($attributes['template']);
return parent::create($attributes);
}
public function update(array $attributes = [], array $options = [])
{
+ if (!isset($attributes['template']) || !$attributes['template']) {
+ $attributes['template']='unset';
+ }
$this->useTemplate($attributes['template']);
return parent::update($attributes, $options);
}
$this->useTemplateIfNotSet($attributes['template']);
}
- $res = parent::setRawAttributes($attributes, $sync);
- return $res;
+ return parent::setRawAttributes($attributes, $sync);
}
public static function getPagesList($variant = null)
if ($this instanceof CMSPage) {
$this->useTemplate();
}
- parent::copyTranslations($from, $to, $overwrite); // TODO: Change the autogenerated stub
+ parent::copyTranslations($from, $to, $overwrite);
}
}
$this->addFieldAtEnd([
'name' => 'meta_title',
- 'label' => trans('backpack::pagemanager.meta_title'),
+ 'label' => 'Titre ',
'type' => 'Text',
- 'hint' => 'Si vide, le titre court est utilisé' . ' ' . 'Longueur recommandée : 60 caractères',
+ 'hint' => 'Contenu de la balise <title>. Si vide, le titre court est utilisé' . ' ' . 'Longueur recommandée : 60 caractères',
'tab' => $tab,
'fake' => true,
'store_in' => 'seo',
$this->addFieldAtEnd([
'name' => 'meta_description',
- 'label' => trans('backpack::pagemanager.meta_description'),
+ 'label' => 'Description',
'type' => 'Textarea',
- 'hint' => 'Longueur recommandée : 160 caractères',
+ 'hint' => 'Contenu de <meta name="description">. Longueur recommandée : 160 caractères',
'tab' => $tab,
'fake' => true,
'store_in' => 'seo',
'default' => true,
'tab' => $tab,
'fake' => true,
+ 'translatable'=>false,
'store_in' => 'seo',
]);
'hint' => 'Liste des URL alternatives correspondant à cette page. Peut être utilisé lors de la migration. Si un visiteur tape une de ces URL, il sera redirigé vers cette page.',
'tab' => $tab,
'fake' => true,
+ 'translatable'=>false,
'store_in' => 'seo']);
}
{
}
+
+ public function showInDropDown()
+ {
+ return true;
+ }
}
]
);
}
+
+ public function showInDropDown()
+ {
+ return true;
+ }
}
return '* Navigation';
}
+ public function showInDropDown()
+ {
+ return true;
+ }
}
{
return '* Redirection externe';
}
+
+ public function showInDropDown()
+ {
+ return true;
+ }
}
self::$_templates = [];
$roots = [__DIR__ => 'Cubist\\Backpack\\Template', app_path() . '/Templates' => 'App\\Templates'];
foreach ($roots as $templates_root => $prefix) {
+
if (!file_exists($templates_root)) {
continue;
}
$dr = opendir($templates_root);
while ($file = readdir($dr)) {
+
if ($file == '.' || $file == '..' || is_dir($templates_root . '/' . $file)) {
continue;
}
--- /dev/null
+<?php
+
+namespace Cubist\Backpack\Template;
+
+class Undefined extends TemplatePage
+{
+ public function showInDropDown()
+ {
+ return true;
+ }
+}
{{-- ########################################## --}}
{{-- Extra CSS and JS for this particular field --}}
{{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}}
-@if ($crud->checkIfFieldIsFirstOfItsType($field))
+
+
{{-- FIELD CSS - will be loaded in the after_styles section --}}
@push('crud_fields_styles')
- <!-- include select2 css-->
- <link href="{{ asset('packages/select2/dist/css/select2.min.css') }}" rel="stylesheet"
- type="text/css"/>
- <link
- href="{{ asset('packages/select2-bootstrap-theme/dist/select2-bootstrap.min.css') }}"
- rel="stylesheet" type="text/css"/>
+ {{-- include select2 css --}}
+ @basset('https://unpkg.com/select2@4.0.13/dist/css/select2.min.css')
+ @basset('https://unpkg.com/select2-bootstrap-theme@0.1.0-beta.10/dist/select2-bootstrap.min.css')
@endpush
{{-- FIELD JS - will be loaded in the after_scripts section --}}
@push('crud_fields_scripts')
- <!-- include select2 js -->
- <script src="{{ asset('packages/select2/dist/js/select2.min.js') }}"></script>
+ {{-- include select2 js --}}
+ @basset('https://unpkg.com/select2@4.0.13/dist/js/select2.full.min.js')
+ @if (app()->getLocale() !== 'en')
+ @basset('https://unpkg.com/select2@4.0.13/dist/js/i18n/' . str_replace('_', '-', app()->getLocale()) . '.js')
+ @endif
+ @bassetBlock('backpack/pro/fields/select2-from-array-field.js')
<script>
jQuery(document).ready(function ($) {
$(document).on('cubist.bunchmultiple.added', function () {
showSelectedValue();
}
</script>
+ @endBassetBlock
@endpush
-
-@endif
{{-- End of Extra CSS and JS --}}
{{-- ########################################## --}}