From dc8876223e60fc01f74262db7d380558e164805b Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 4 Nov 2008 04:12:54 +0000 Subject: [PATCH] MINOR Code formatting on HtmlEditorField functions MINOR phpDoc of HtmlEditorField git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65205 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/HtmlEditorField.php | 109 ++++++++++++++++++++++---------------- 1 file changed, 64 insertions(+), 45 deletions(-) diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index bb2bc263d..f2e126a86 100755 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -341,79 +341,98 @@ class HtmlEditorField_Toolbar extends RequestHandler { } /** - * Returns the form which the Link button returns. - * The link functions below are shown and hidden via javascript + * Return a {@link Form} instance allowing a user to + * add links in the TinyMCE content editor. + * + * @return Form */ function LinkForm() { $form = new Form( $this->controller, "{$this->name}/LinkForm", new FieldSet( - new LiteralField('Heading', '

'._t('HtmlEditorField.CLOSE', 'close').''._t('HtmlEditorField.LINK', 'Link').'

'), - new OptionsetField("LinkType", _t('HtmlEditorField.LINKTO', "Link to"), + new LiteralField('Heading', '

' . _t('HtmlEditorField.CLOSE', 'close').'' . _t('HtmlEditorField.LINK', 'Link') . '

'), + new OptionsetField( + 'LinkType', + _t('HtmlEditorField.LINKTO', 'Link to'), array( - "internal" => _t('HtmlEditorField.LINKINTERNAL',"Page on the site"), - "external" => _t('HtmlEditorField.LINKEXTERNAL',"Another website"), - "anchor" => _t('HtmlEditorField.LINKANCHOR',"Anchor on this page"), - "email" => _t('HtmlEditorField.LINKEMAIL', "Email address"), - "file" => _t('HtmlEditorField.LINKFILE', "Download a file"), + 'internal' => _t('HtmlEditorField.LINKINTERNAL', 'Page on the site'), + 'external' => _t('HtmlEditorField.LINKEXTERNAL', 'Another website'), + 'anchor' => _t('HtmlEditorField.LINKANCHOR', 'Anchor on this page'), + 'email' => _t('HtmlEditorField.LINKEMAIL', 'Email address'), + 'file' => _t('HtmlEditorField.LINKFILE', 'Download a file'), ) ), - new TreeDropdownField("internal", _t('HtmlEditorField.PAGE', "Page"), "SiteTree", "URLSegment", "MenuTitle"), - new TextField("external", _t('HtmlEditorField.URL', "URL"), 'http://'), - new EmailField("email", _t('HtmlEditorField.EMAIL', "Email address")), - new TreeDropdownField("file",_t('HtmlEditorField.FILE', "File"),"File", "Filename"), - new TextField("Anchor", _t('HtmlEditorField.ANCHORVALUE', "Anchor")), - new TextField("LinkText", _t('HtmlEditorField.LINKTEXT', "Link text")), - new TextField("Description", _t('HtmlEditorField.LINKDESCR', "Link description")), - new CheckboxField("TargetBlank", _t('HtmlEditorField.LINKOPENNEWWIN', "Open link in a new window?")) + new TreeDropdownField('internal', _t('HtmlEditorField.PAGE', "Page"), 'SiteTree', 'URLSegment', 'MenuTitle'), + new TextField('external', _t('HtmlEditorField.URL', 'URL'), 'http://'), + new EmailField('email', _t('HtmlEditorField.EMAIL', 'Email address')), + new TreeDropdownField('file', _t('HtmlEditorField.FILE', 'File'), 'File', 'Filename'), + new TextField('Anchor', _t('HtmlEditorField.ANCHORVALUE', 'Anchor')), + new TextField('LinkText', _t('HtmlEditorField.LINKTEXT', 'Link text')), + new TextField('Description', _t('HtmlEditorField.LINKDESCR', 'Link description')), + new CheckboxField('TargetBlank', _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')) ), new FieldSet( - new FormAction("insert", _t('HtmlEditorField.BUTTONINSERTLINK', "Insert link")), - new FormAction("remove", _t('HtmlEditorField.BUTTONREMOVELINK', "Remove link")) + new FormAction('insert', _t('HtmlEditorField.BUTTONINSERTLINK', 'Insert link')), + new FormAction('remove', _t('HtmlEditorField.BUTTONREMOVELINK', 'Remove link')) ) ); + $form->loadDataFrom($this); + return $form; } + /** + * Return a {@link Form} instance allowing a user to + * add images to the TinyMCE content editor. + * + * @return Form + */ function ImageForm() { $form = new Form( $this->controller, - "{$this->name}/ImageForm", + "{$this->name}/ImageForm", new FieldSet( - new LiteralField('Heading', '

'._t('HtmlEditorField.CLOSE', 'close').''._t('HtmlEditorField.IMAGE', 'Image').'

'), - new TreeDropdownField("FolderID", _t('HtmlEditorField.FOLDER', "Folder"), "Folder"), + new LiteralField('Heading', '

' . _t('HtmlEditorField.CLOSE', 'close') . '' . _t('HtmlEditorField.IMAGE', 'Image') . '

'), + new TreeDropdownField('FolderID', _t('HtmlEditorField.FOLDER', 'Folder'), 'Folder'), new LiteralField('AddFolderOrUpload', - '
- ' . _t('HtmlEditorField.CREATEFOLDER','create folder') . ' - - - -
|
-
- ' . _t('HtmlEditorField.UPLOAD','upload') . ' -
- '), - new ThumbnailStripField("Image", "FolderID", "getimages"), - new TextField("AltText", _t('HtmlEditorField.ALTTEXT', "Description"), "", 80), - new DropdownField("CSSClass", _t('HtmlEditorField.CSSCLASS', "Alignment / style"), array( - "left" => _t('HtmlEditorField.CSSCLASSLEFT', "On the left, with text wrapping around."), - "leftAlone" => _t('HtmlEditorField.CSSCLASSLEFTALONE', "On the left, on its own."), - "right" => _t('HtmlEditorField.CSSCLASSRIGHT', "On the right, with text wrapping around."), - "center" => _t('HtmlEditorField.CSSCLASSCENTER', "Centered, on its own."), - )), - new FieldGroup(_t('HtmlEditorField.IMAGEDIMENSIONS', "Dimensions"), - new TextField("Width", _t('HtmlEditorField.IMAGEWIDTHPX', "Width"), 100), - new TextField("Height", "x " . _t('HtmlEditorField.IMAGEHEIGHTPX', "Height"), 100) + '
+ ' . _t('HtmlEditorField.CREATEFOLDER','create folder') . ' + + + +
+
|
+
+ ' . _t('HtmlEditorField.UPLOAD','upload') . ' +
' + ), + new ThumbnailStripField('Image', 'FolderID', 'getimages'), + new TextField('AltText', _t('HtmlEditorField.ALTTEXT', 'Description'), '', 80), + new DropdownField( + 'CSSClass', + _t('HtmlEditorField.CSSCLASS', 'Alignment / style'), + array( + 'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), + 'leftAlone' => _t('HtmlEditorField.CSSCLASSLEFTALONE', 'On the left, on its own.'), + 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.'), + 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'), + ) + ), + new FieldGroup(_t('HtmlEditorField.IMAGEDIMENSIONS', 'Dimensions'), + new TextField('Width', _t('HtmlEditorField.IMAGEWIDTHPX', 'Width'), 100), + new TextField('Height', "x " . _t('HtmlEditorField.IMAGEHEIGHTPX', 'Height'), 100) ) ), new FieldSet( - new FormAction("insertimage", _t('HtmlEditorField.BUTTONINSERTIMAGE', 'Insert image')), - new FormAction("editimage", _t('HtmlEditorField.BUTTONEDITIMAGE', 'Edit image')) + new FormAction('insertimage', _t('HtmlEditorField.BUTTONINSERTIMAGE', 'Insert image')), + new FormAction('editimage', _t('HtmlEditorField.BUTTONEDITIMAGE', 'Edit image')) ) ); + $form->loadDataFrom($this); + return $form; }