Source of file KapostPageSettingsControllerExtension.php
Size: 1,213 Bytes - Last Modified: 2021-12-23T10:57:38+00:00
/var/www/docs.ssmods.com/process/src/code/extensions/KapostPageSettingsControllerExtension.php
123456789101112131415161718192021222324252627282930313233343536 | <?php /** * Class KapostPageSettingsControllerExtension * * @property CMSPageSettingsController $owner */ class KapostPageSettingsControllerExtension extends Extension { /** * Updates the form to make all of the fields read only with the exception of a few fields * @param Form $form Form to be adjusted */ public function updateEditForm(Form $form) { $record=$form->getRecord(); if($record) { $kapostRefID=$record->KapostRefID; if(empty($kapostRefID)) { return; } //Make the fields all read only $oldFields=$form->Fields(); $form->setFields($oldFields->makeReadonly()); //Make the fields that should be non-readonly editable again if(is_array($record->config()->non_readonly_settings_fields)) { foreach($record->config()->non_readonly_settings_fields as $fieldName) { $oldField=$oldFields->dataFieldByName($fieldName); if($oldField) { $form->Fields()->replaceField($fieldName, $oldField); } } } } } } ?> |