Skip to content

How variables are saved ?

Sebastien Lucas edited this page Aug 23, 2012 · 1 revision

This element value is saved automatically in variable table in the chartbeat_usenewsbeat variable

 $form['chartbeat_usenewsbeat'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use chartbeat publishing'),
    '#description' => t('Chartbeat publishing is a special edition of charbeat for journalists. ', array ('@newsbeat' =>'http://chartbeat.com/publishing')),
    '#default_value' => variable_get('chartbeat_usenewsbeat', ''),
  );

If there is sub element the variable serialize an array

  $rue89_mailtemplates = variable_get('rue89_comments_mailtemplate', array());

that could be accessed this way

'#default_value' => !empty($rue89_mailtemplates['template'][$i]['text']) ? $rue89_mailtemplates['template'][$i]['text'] : '',

WIKI by Sébastien Lucas CEO & Funder or Bricks

Clone this wiki locally