function alinks_edit_form in Alinks 7
Same name and namespace in other branches
- 6 alinks.module \alinks_edit_form()
Generate the form used to edit alinks
2 string references to 'alinks_edit_form'
- alinks_menu in ./
alinks.module - Implementation of hook_menu().
- alinks_page in ./
alinks.module - Generate the page that will render the forms for adding and editing Alinks
File
- ./
alinks.module, line 374 - this module allows users to associates defined text to links
Code
function alinks_edit_form() {
$form['alinks_edit_form'] = array(
'#type' => 'fieldset',
'#title' => t('Edit alinks'),
'#description' => t('Use this form to edit alinks. If you want to delete an entry, just select the corresponding ' . 'checkbox. To edit the entry, edit the desired text. Click update to confirm any changes.'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$result = db_select('alinks', 'a')
->extend('PagerDefault')
->orderBy('alink_weight')
->orderBy('alink_text')
->limit('30')
->fields('a')
->execute();
if ($result
->rowCount() > 0) {
$form['alinks_edit_form']['edit_alink'] = array(
'#tree' => TRUE,
);
foreach ($result as $alink) {
$alinks[$alink->id] = $alink;
$form['alinks_edit_form']['edit_alink'][$alink->id]['start_boundary_edit'] = array(
'#type' => 'checkbox',
'#default_value' => $alink->alink_start_boundary,
);
$form['alinks_edit_form']['edit_alink'][$alink->id]['word_edit'] = array(
'#type' => 'textfield',
'#size' => 10,
'#maxlength' => 255,
'#default_value' => $alink->alink_text,
'#required' => TRUE,
);
$form['alinks_edit_form']['edit_alink'][$alink->id]['end_boundary_edit'] = array(
'#type' => 'checkbox',
'#default_value' => $alink->alink_end_boundary,
);
$form['alinks_edit_form']['edit_alink'][$alink->id]['case_insensitive_edit'] = array(
'#type' => 'checkbox',
'#default_value' => $alink->alink_case_insensitive,
);
$form['alinks_edit_form']['edit_alink'][$alink->id]['url_edit'] = array(
'#type' => 'textfield',
'#size' => 30,
'#maxlength' => 255,
'#default_value' => $alink->alink_url,
'#required' => TRUE,
);
$form['alinks_edit_form']['edit_alink'][$alink->id]['url_title_edit'] = array(
'#type' => 'textfield',
'#size' => 30,
'#maxlength' => 255,
'#default_value' => $alink->url_title,
);
$form['alinks_edit_form']['edit_alink'][$alink->id]['external_edit'] = array(
'#type' => 'checkbox',
'#default_value' => $alink->alink_external,
);
$form['alinks_edit_form']['edit_alink'][$alink->id]['class_edit'] = array(
'#type' => 'textfield',
'#size' => 30,
'#maxlength' => 255,
'#default_value' => $alink->alink_class,
);
$form['alinks_edit_form']['edit_alink'][$alink->id]['weight_edit'] = array(
'#type' => 'weight',
'#default_value' => $alink->alink_weight,
);
$form['alinks_edit_form']['edit_alink'][$alink->id]['weight_edit']['#attributes']['class'] = array(
'alinks-weight',
);
$form['alinks_edit_form']['edit_alink'][$alink->id]['delete'] = array(
'#type' => 'checkbox',
);
}
$form['pager'] = array(
'#markup' => theme('pager'),
);
$form['alinks_edit_form']['save_edit'] = array(
'#type' => 'submit',
'#value' => t('Update alinks'),
);
$form['alinks_edit_form']['alinks'] = array(
'#type' => 'value',
'#value' => $alinks,
);
$form['alinks_edit_form']['#theme'] = 'alinks_list';
}
return $form;
}