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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Passing a variable to getCMSFields_forPopup


Reply

3 Posts   389 Views

Avatar
lozhowlett

17 August 2012 at 1:58am Community Member, 146 Posts

Hi

Is there anyway to pass a variable to getCMSFields_forPopup?

$tablefield = new HasManyDataObjectManager(
$this,
'FixtureHomePlayers',
'FixtureHomePlayer',
array(
'TeamPlayer.PlayerName' => 'Name',
'TeamPlayer.PlayerPosition' => 'Position',
'Tries' => 'Tries',
'Goals' => 'Goals'
),
'getCMSFields_forPopup(VARIABLE-NAME-HERE)',
'Team.ID='.$this->HomeTeamID, //filter
'TeamPlayer.PlayerName', //sort
'LEFT JOIN TeamPlayer ON FixtureHomePlayer.TeamPlayerID=TeamPlayerID LEFT JOIN Team ON TeamPlayer.TeamID=Team.ID' //join

);
$fields->addFieldToTab("Root.Content.HomeTeam",$tablefield);

But that does not work, I need to pass the HomeTeamID to the popup, so it only loads players for that team.

Cheers

Avatar
lozhowlett

21 August 2012 at 2:37am Community Member, 146 Posts

*Bump*

Avatar
swaiba

21 August 2012 at 7:38am Forum Moderator, 1796 Posts

hmmm not a nice solution, but you *could* set a session variable (that is blanked on navigation away)

that session variable could be read elsewhere... but this is guess I don't understand what you are trying to do