$bookmarks = $this->_unserialize($bookmarks, $default);
$res = [];
foreach ($bookmarks as $bookmark) {
- $bookmark['title'] = $bookmark['titre'];
- unset($bookmark['titre']);
+ if (isset($bookmark['titre'])) {
+ $bookmark['title'] = $bookmark['titre'];
+ unset($bookmark['titre']);
+ } else {
+ $bookmark['title'] = '';
+ }
$res[] = $bookmark;
}
return $res;
}
$res = [];
foreach ($v as $k => $chapter) {
- $chapter['type'] = 'regular';
+ $chapter['decoration'] = 'regular';
$chapter['label'] = trim($chapter['label']);
if ($chapter['label'] === '----') {
$chapter['label'] = '';
- $chapter['type'] = 'separator';
+ $chapter['decoration'] = 'separator';
} else if ($chapter['label'] === '--') {
$chapter['label'] = '';
- $chapter['type'] = 'forcecut';
+ $chapter['decoration'] = 'forcecut';
} else if ($chapter['label'] === '++') {
$chapter['label'] = '';
- $chapter['type'] = 'nocut';
+ $chapter['decoration'] = 'nocut';
} else if (str_starts_with($chapter['label'], '!!!')) {
$chapter['label'] = substr($chapter['label'], 3);
- $chapter['type'] = 'column_head';
+ $chapter['decoration'] = 'column_head';
}
$res[$k] = $chapter;
}
use App\Fields\FluidbookChapterLevel;
use Cubist\Backpack\Magic\Fields\Color;
+use Cubist\Backpack\Magic\Fields\Field;
use Cubist\Backpack\Magic\Fields\SelectFromArray;
use Cubist\Backpack\Magic\Fields\Text;
use Cubist\Backpack\Magic\SubForm;
$this->addField('label', Text::class, __('Nom du chapitre'), ['when' => $when, 'placeholder' => __('Label')]);
$this->addField('page', Text::class, __('Page'), ['when' => $when, 'placeholder' => __('Page')]);
$this->addField('color', Color::class, __('Couleur'), ['when' => $when, 'allows_empty' => true, 'allows_alpha' => false, 'default' => null]);
- $this->addField('type', SelectFromArray::class, __('Type'), ['default' => 'regular', 'options' =>
+ $this->addField('decoration', SelectFromArray::class, __('Type'), ['ajax' => false, 'allows_null' => false, 'options' =>
[
'regular' => __('Chapitre normal'),
'column_head' => __('Titre de colonne') . ' (!!!)',
width: 54px;
}
- .bunchmultiple_oneline .bunchmultiple__wrapper .item .legend .legendsize .form-group[data-name="type"] {
+ .bunchmultiple_oneline .bunchmultiple__wrapper .item .legend .legendsize .form-group[data-name="decoration"] {
width: 160px;
}
</style>