Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » adding pageID to a HMCTF

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: 1164 Views
  • marcink
    Avatar
    Community Member
    89 Posts

    adding pageID to a HMCTF Link to this post

    hi,

    i have written a module, that adds a HMCTF to the Page dataobject, so i can use the HMCTF in every object that extends Page. for this, i decorated the Page with DOD.

    now i would like to save the id of the active SiteTree object within the dataobject, so i can display only the dataobjects relevant to the site.

    and here i'm stuck.
    i was trying to add a TextField to the HMCTF with the id i get with $this->owner->ID, but it seems not to work.

    my (simplified) updateCMSFields function in the decorator looks like:

    public function updateCMSFields(FieldSet &$fields) {
    $tableField = new HasManyComplexTableField(
    $this->owner,
    "items", // name of the relation
    "DataObject", // my extension of the DataObject
    array(
    "field1" => "field1",
    .....
    ),
    "getCMSFields_forPopup"
    );
    }


    can i somehow "inject" a value to the FieldSet returned by getCMSFields_forPopup??

    thanks

  • marcink
    Avatar
    Community Member
    89 Posts

    Re: adding pageID to a HMCTF Link to this post

    update: writing this entry i had an idea, that was the solution....

    instead of: "getCMSFields_forPopup" in the updateCMSFields() function, i just created a new FieldSet with the extrax data i neaded...

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