Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » CustomSiteConfig content from tabs --> to html content

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: 381 Views
  • jouni
    Avatar
    Community Member
    3 Posts

    CustomSiteConfig content from tabs --> to html content Link to this post

    I have a sidebar in my site where should be a logo list.
    Logos would be editable from backend.

    I think I have done my backend stuff, CustomSiteConfig and datamodel correctly,
    but I don't know how to pull this information into html content.

    CustomSiteConfig.php

    <?php

    class CustomSiteConfig extends Extension {

    function extraStatics() {
    return array(
    'has_many' => array(
    'Logos' => 'Logo'
    )
    );
    }

    public function updateCMSFields(FieldSet &$fields) {

    $manager = new DataObjectManager(
    $this->owner,
    'Logos',
    'Logo',
    Logo::$summary_fields,
    'getCMSFields_forPopup'
    );
    $fields->addFieldToTab("Root.Logot", $manager);

    }

    }

    Logo.php

    <?php

    class Logo extends DataObject
    {
    static $db = array (
       'Name' => 'Text',
       'AltText' => 'Text',
       'Link' => 'Text'   
    );
       
       
       
    static $has_one = array (
       'SiteConfig' => 'SiteConfig',
       'LogoImage' => 'Image',
       'LogoPage' => 'SiteTree'
    );
       
    public function getCMSFields_forPopup()
       {
          return new FieldSet(
             new TextField('Name'),
             new TextField('Link'),
             new TextField('AltText'),
             new ImageField('LogoImage')
          );
       }
    }

    ?>

  • UncleCheese
    Avatar
    4085 Posts

    Re: CustomSiteConfig content from tabs --> to html content Link to this post

    <% control SiteConfig.Logos %>

    ---------------
    Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

  • jouni
    Avatar
    Community Member
    3 Posts

    Re: CustomSiteConfig content from tabs --> to html content Link to this post

    <% control SiteConfig.Logos %>
    $Name
    <% end_control %>

    Like this?
    It just doesn't work.. Maybe there's something from with my files after all

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