I created a config form in the admin/config page. (Just a link field that needs to be saved for later retrieval) Im confused as to how to save and retrieve the form data.
When creating a custom form in a block I have been successful using:
variable_get('link_title', '')
However when creating a custom form it seems to require a different way. I attempted to save the data in hook_form_submit. However Im not sure how to retrieve when you return to the form at a later date.
function read_more_news_admin_form($form, &$form_state) {
$form = array();
$form['link_container'] = array(
'#type' => 'container',
'#attributes' => array('class' => array('some-class')),
'#tree' => TRUE,
);
$form['link_container']['link'] = array(
'#type' => 'link_field',
'#field_name' => 'link_field',
'#language' => 'und',
'#field_parents' => array(),
'#delta' => 0,
'#default_value' => array(
'title' => variable_get('link_title', ''),
'url' => variable_get('link_url', ''),
),
);
return system_settings_form($form);
}
function read_more_news_form_submit($form_id, $form_values) {
drupal_write_record('readmorelink', $form_state['values']);
}