Created
May 9, 2018 15:01
-
-
Save muskie9/d5ee635abf631e8821ae45fb121e416e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 FileDataExtension | |
*/ | |
class FileDataExtension extends DataExtension | |
{ | |
/** | |
* @param FieldList $fields | |
*/ | |
public function updateCMSFields(FieldList $fields) | |
{ | |
if (Permission::check('ADMIN')) { | |
$fields->push(CheckboxField::create('ShowInSearch')->setTitle('Show In Search')); | |
} | |
} | |
/** | |
* | |
*/ | |
public function onBeforeWrite() | |
{ | |
parent::onBeforeWrite(); | |
$this->owner->ShowInSearch = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment