Created
June 18, 2015 11:59
-
-
Save sminnee/eaca6614478073aab8c7 to your computer and use it in GitHub Desktop.
Adding a dropdown to a StaffHolder...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class StaffHolder extends Page | |
{ | |
//... | |
public function getCMSFields() { | |
$fields = parent::getCMSFields(); | |
$blob = new DropdownField( | |
'EmployeeOfTheMonthID', | |
'Employee of the month', | |
$this | |
->Children() | |
->filter('ClassName', 'StaffPage') | |
->sort('Title') | |
->map('ID', 'Title') | |
); | |
$blob->setEmptyString('(Select)'); | |
$fields->addFieldToTab( | |
'Root.Main', | |
$blob, | |
'Content' | |
); | |
return $fields; | |
} | |
} | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if EmployeeOfTheMonth %> | |
<h2>Employee of the month is | |
<a href="$EmployeeOfTheMonth.Link"> | |
$EmployeeOfTheMonth.Title | |
</a> | |
</h2> | |
<% end_if %> | |
<!-- ... rest of file goes here --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment