mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #3312 from tractorcow/pulls/3.1/extend-htmleditor-parentid
API Let extensions control folder selector in HtmlEditorField_Toolbar
This commit is contained in:
commit
59e7f777a2
@ -309,6 +309,17 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the folder ID to filter files by for the "from cms" tab
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
protected function getAttachParentID() {
|
||||||
|
$parentID = $this->controller->getRequest()->requestVar('ParentID');
|
||||||
|
$this->extend('updateAttachParentID', $parentID);
|
||||||
|
return $parentID;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@link Form} instance allowing a user to
|
* Return a {@link Form} instance allowing a user to
|
||||||
* add images and flash objects to the TinyMCE content editor.
|
* add images and flash objects to the TinyMCE content editor.
|
||||||
@ -318,7 +329,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
public function MediaForm() {
|
public function MediaForm() {
|
||||||
// TODO Handle through GridState within field - currently this state set too late to be useful here (during
|
// TODO Handle through GridState within field - currently this state set too late to be useful here (during
|
||||||
// request handling)
|
// request handling)
|
||||||
$parentID = $this->controller->getRequest()->requestVar('ParentID');
|
$parentID = $this->getAttachParentID();
|
||||||
|
|
||||||
$fileFieldConfig = GridFieldConfig::create()->addComponents(
|
$fileFieldConfig = GridFieldConfig::create()->addComponents(
|
||||||
new GridFieldFilterHeader(),
|
new GridFieldFilterHeader(),
|
||||||
@ -346,7 +357,9 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
$fromCMS = new CompositeField(
|
$fromCMS = new CompositeField(
|
||||||
new LiteralField('headerSelect',
|
new LiteralField('headerSelect',
|
||||||
'<h4>'.sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.FindInFolder', 'Find in Folder')).'</h4>'),
|
'<h4>'.sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.FindInFolder', 'Find in Folder')).'</h4>'),
|
||||||
$select = TreeDropdownField::create('ParentID', "", 'Folder')->addExtraClass('noborder'),
|
$select = TreeDropdownField::create('ParentID', "", 'Folder')
|
||||||
|
->addExtraClass('noborder')
|
||||||
|
->setValue($parentID),
|
||||||
$fileField
|
$fileField
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user