Enhancement add EmailLink form factory server-side

This commit is contained in:
Christopher Joe 2017-05-05 22:09:10 +12:00 committed by Sam Minnée
parent c58dc97d39
commit edcb220e4a

View File

@ -3,6 +3,7 @@
namespace SilverStripe\Forms\HTMLEditor;
use SilverStripe\Admin\Forms\EditorExternalLinkFormFactory;
use SilverStripe\Admin\Forms\EditorEmailLinkFormFactory;
use SilverStripe\Assets\File;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Controller;
@ -36,6 +37,7 @@ class HTMLEditorField_Toolbar extends RequestHandler
private static $allowed_actions = array(
'LinkForm',
'EditorExternalLink',
'EditorEmailLink',
'viewfile',
'getanchors'
);
@ -199,6 +201,22 @@ class HTMLEditorField_Toolbar extends RequestHandler
return null;
}
/**
* Builds and returns the external link form
*
* @return null|Form
*/
public function EditorEmailLink($id = null)
{
/** @var EditorEmailLinkFormFactory $factory */
$factory = Injector::inst()->get(EditorEmailLinkFormFactory::class);
if ($factory) {
return $factory->getForm($this->controller, "{$this->name}/EditorEmailLink");
}
return null;
}
/**
* Get the folder ID to filter files by for the "from cms" tab
*