Source of file MemberProfileSection.php
Size: 1,735 Bytes - Last Modified: 2022-02-21T10:00:57+00:00
/var/www/docs.ssmods.com/process/src/code/dataobjects/MemberProfileSection.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 | <?php /** * A section of a public profile page. * * @package silverstripe-memberprofiles * @subpackage dataobjects */ class MemberProfileSection extends DataObject { private static $db = array( 'CustomTitle' => 'Varchar(100)' ); private static $has_one = array( 'Parent' => 'MemberProfilePage' ); private static $extensions = array( // 'Orderable' ); private static $summary_fields = array( 'DefaultTitle' => 'Title', 'CustomTitle' => 'Custom Title' ); protected $member; /** * @return Member */ public function getMember() { return $this->member; } /** * @param Member $member */ public function setMember($member) { $this->member = $member; } public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab( 'Root.Main', array( new ReadonlyField('DefaultTitle', _t('MemberProfiles.SECTIONTYPE', 'Section type')), new HiddenField('ClassName', '') ), 'CustomTitle' ); return $fields; } /** * @return string */ public function getTitle() { return $this->CustomTitle ? $this->CustomTitle: $this->getDefaultTitle(); } /** * Returns the title for this profile section. You must implement this in * subclasses. * * @return string */ public function getDefaultTitle() { throw new Exception("Please implement getDefaultTitle() on {$this->class}."); } /** * Controls whether the title is shown in the template. * * @return bool */ public function ShowTitle() { return true; } /** * Returns the content to be rendered into the profile template. * * @return string */ public function forTemplate() { throw new Exception("Please implement forTemplate() on {$this->class}."); } } |