Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Files & Images

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

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

Page: 1
Go to End
Author Topic: 1742 Views
  • cindycin
    Avatar
    Community Member
    20 Posts

    Files & Images Link to this post

    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

  • cindycin
    Avatar
    Community Member
    20 Posts

    Re: Files & Images Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Files & Images Link to this post

    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

  • cindycin
    Avatar
    Community Member
    20 Posts

    Re: Files & Images Link to this post

    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)

  • cindycin
    Avatar
    Community Member
    20 Posts

    Re: Files & Images Link to this post

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

    1742 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.