schema() public méthode

Set the data definition to load/save from the config.
public schema ( array $Def = null )
$Def array A list of fields from the config that this form will use.
Exemple #1
0
 /**
  *
  * @param  object $sender SettingsController.
  * @return void.
  * @package Shariff
  * @since 0.1
  */
 public function settingsController_shariff_create($sender)
 {
     $sender->permission('Garden.Settings.Manage');
     $sender->addSideMenu('dashboard/settings/plugins');
     $sender->title(t('Shariff Settings'));
     $sender->setData('Description', t('Shariff Setup Description'));
     // Save values to config.
     if ($sender->Form->authenticatedPostBack()) {
         $formPostValues = $sender->Form->formValues();
         $services = $formPostValues['Shariff.Services'];
         $dataServices = '["' . implode('","', $services) . '"]';
         saveToConfig('Shariff.Services', $services);
         saveToConfig('Shariff.DataServices', $dataServices);
         saveToConfig('Shariff.Theme', $formPostValues['Shariff.Theme']);
     }
     $sender->Form->setData(array('Shariff.Services' => c('Shariff.Services'), 'Shariff.Theme' => c('Shariff.Theme')));
     $configurationModule = new ConfigurationModule($sender);
     // fill in all the info that is needed to build the settings view
     $configurationModule->schema(array('Shariff.Services' => array('Control' => 'CheckBoxList', 'Description' => t('Check services that should be enabled.'), 'Items' => array('facebook' => 'facebook', 'Google+' => 'googleplus', 'LinkedIn' => 'linkedin', t('E-Mail') => 'mail', 'Twitter' => 'twitter', 'Pinterest' => 'pinterest', 'WhatsApp' => 'whatsapp', 'Xing' => 'xing'), 'LabelCode' => 'Services'), 'Shariff.Theme' => array('Control' => 'DropDown', 'Items' => array('standard' => t('Standard'), 'grey' => t('Grey'), 'white' => t('White')), 'LabelCode' => 'Theme', 'Options' => array('IncludeNull' => false))));
     $configurationModule->renderAll();
 }