silverstripe-carousel 

silverstripe-carousel Commit Details

Date:2016-06-09 19:43:59 (4 years 29 days ago)
Author:Nicola Fontana
Branch:dev, master
Commit:a729b710cb3d8cad7f0843cb84e07f1c27728245
Parents: ac88bed7bd459c5968d53636bbfd473985cb5126
Message:Fix bug in empty caption editing

After commit a8ace7534194 in silverstripe-framework, caption editing got
lost. That commit prevents the automatic generation of JS configuration
for TinyMCE, so I have to forcibly trigger the generation in my code.
This must be done conditionally because the method to use is not present
in 3.2.
Changes:
Mcode/CarouselPage.php (3 diffs)

File differences

code/CarouselPage.php
5050
5151
5252
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
5372
5473
5574
......
123142
124143
125144
145
126146
127147
128148
......
167187
168188
169189
170
171
172
173
174
175
176
190
177191
178192
179193
return $backend;
}
}
/**
* Retrieve the fields used by SortableUploadField internal form.
*
* @return FieldList
*/
public function getCarouselEditFields()
{
// This is *required* otherwise TinyMCE in SilverStripe 3.3 will
// not be enabled and the <textarea> will simply disappear
// without apparent reasons
if (method_exists('HtmlEditorConfig', 'require_js')) {
HtmlEditorConfig::require_js();
}
$fields = FieldList::create();
$fields->push(CarouselCaptionField::create('Content', _t('CarouselPage.Caption')));
return $fields;
}
}
/**
),
);
/**
* Search the first class name (that must have a 'Page' suffix) in
* the object hierarchy that has a correspoding folder in
$field = SortableUploadField::create('Images', _t('CarouselPage.db_Images'));
$field->setFolderName($this->getClassFolder());
// Enable HTML caption handling if captions are enabled
if ($this->Captions) {
$caption = CarouselCaptionField::create('Content', _t('CarouselPage.Caption'));
$field->setFileEditFields(FieldList::create($caption));
unset($caption);
}
$field->setFileEditFields('getCarouselEditFields');
$root = $fields->fieldByName('Root');
$tab = $root->fieldByName('Images');

Archive Download the corresponding diff file