Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Files & Images


Go to End


5 Posts   2022 Views

Avatar
cindycin

Community Member, 20 Posts

17 July 2008 at 12:36pm

I would like to add an additional text field under the View/Edit Asset window. I would like it to be a textarea field with a WYSIWYG HTML formatter above for my client to use. Does anyone know if this can be done? If not the WYSIWYG how do I add the extra data field (textarea) for my assets?

Thanks for you help, time and patience

-cindycin

Avatar
cindycin

Community Member, 20 Posts

17 July 2008 at 1:12pm

I'm wondering if I can use the following:

----------
HTMLEditorField: A WYSIWYG editor field, powered by tinymce.
HTMLOneLineField: Same as HTMLEditorField, but only one line
----------

I just can't seem to find the file that controls the Files & Images tabs in the cms.

Avatar
Willr

Forum Moderator, 5523 Posts

17 July 2008 at 5:15pm

well not quite sure if this is easy or would work but you need to do 2 things

1) add a database field for the content desc to be stored in.

To do this you would need to add an entry in the static $db = array() in sapphire/filesystem/File.php

2) add a HTMLEditorField() to the asset admin

You would have to do this probably by hacking cms/code/AssetAdmin.php look for the getEditForm() method and you would need to add your field in there some how.

Though this would totally break when you updated SS to the latest version :(

Avatar
cindycin

Community Member, 20 Posts

17 July 2008 at 5:48pm

I've actually decided to use the "caption" field under the Gallery Options tab, instead of creating a new database field. I played around with the following code in the AssetTableField.php. I noticed a change when I switched the following from TextField to HtmlEditorField

if(class_exists('GalleryFile')) {
				$detailFormFields->addFieldToTab("BottomRoot", 
					new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'),
						new HtmlEditorField( "Content", _t('AssetTableField.CAPTION', 'Caption') )
					)
				);
			}
		}
		else if (class_exists('GalleryFile')) {
			if( $childData->Extension == 'swf' ) {
				$detailFormFields->addFieldToTab("BottomRoot", 
					new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'),
						new HtmlEditorField( "Content", _t('AssetTableField.CAPTION', 'Caption') ),
						new TextField( 'PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width') ),
						new TextField( 'PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height') ),
						new HeaderField( _t('AssetTableField.SWFFILEOPTIONS', 'SWF File Options') ),
						new CheckboxField( 'Embed', _t('AssetTableField.ISFLASH', 'Is A Flash Document') ),
						new CheckboxField( 'LimitDimensions', _t('AssetTableField.DIMLIMT', 'Limit The Dimensions In The Popup Window') )
					)
				);
			}

----------------

when I made this change the text field complete disappeared. I think I need to pass some parameters with the HtmlEditorField that wasn't required with the TextField. I'm not sure and need help. Can you look at the code above and let me know? I think I'm on the right track but still confused.

Thanks :o)

Avatar
cindycin

Community Member, 20 Posts

19 July 2008 at 2:30am

I think I need to add in some COLUMN and ROW information... is that right? but where?