Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Redirect and Description on FileIFrameField

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 357 Views
  • Pipifix
    Avatar
    Community Member
    54 Posts

    Redirect and Description on FileIFrameField Link to this post

    Hello

    at the moment i try to understand the whole dataobject-thing. my goal is to set some images with a caption and a redirect to different pages. the templaterendering should used on the homepage by a jqery-imageslider (orbit). do i have to use FileIFrameField on a getCMSFields function? or getCMSFields_forPopup. I need to bind the description and the redirect to the CostumImage.

    My code for the dataobject so far.

    <?php
    class CustomImage extends DataObject {
       //db fields
       static $db = array (
    'Description' => 'Varchar(100)'
    );

       /**
        * Our custom image class contains one image that is used on one page.
        */
       public static $has_one = array (
          'SliderImage' => 'Image',
          'PageRedirect' => 'SiteTree'
       );

       /**
        * Popup for editing a single image.
        *
        * @return FieldSet The iframe for editing the image.
        */
       public function getCMSFields(){
          return new FieldSet(
             new FileIFrameField('SliderImage')
          );
       }   
    }

    in HomePage i've got

       public static $has_many = array(
       'CustomImages' => 'CustomImage',
       );

    function getCMSFields() {
          $fields = parent::getCMSFields();
          
          //SliderImages
          $images = new ImageDataObjectManager(
       $this,
       'CustomImages',
       'CustomImage',
       'SliderImage'
          );
          
          
          return $fields;
       }
    }

    Is there a good tutorial about the FileIFrameField or HasManyComplexTableField. Thanks for your help.
    Pipifix

  • Pipifix
    Avatar
    Community Member
    54 Posts

    Re: Redirect and Description on FileIFrameField Link to this post

    The Desription is working. But the sitetree dropdown does'nt work.
    My code for the function getCMSFields in CustomImage.php

    public function getCMSFields(){
          return new FieldSet(
             new TextField('Description'),
             new TreeDropdownField('PageRedirectID','Bild verlinkt zu','SiteTree'),
             new FileIFrameField('SliderImage','Bild für den Slider', Null, Null, Null, 'Uploads/homepage-sliderimages/')
          );
       }

    why is the dropdown not visible? is this a fact of the popup?

    Pipifix

  • Pipifix
    Avatar
    Community Member
    54 Posts

    Re: Redirect and Description on FileIFrameField Link to this post

    Sorry for the crosspost. I moved this issue to this thread: http://www.silverstripe.org/dataobjectmanager-module-forum/show/8358?start=8#post311609

    Thanks, Pipifix

    357 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.