function views_revisions_revision_form in Views Revisions 7
Form constructor for editing a views revision.
Parameters
integer $vrvid: The views revision ID.
See also
views_revisions_revision_form_validate()
views_revisions_revision_form_submit()
1 string reference to 'views_revisions_revision_form'
- views_revisions_menu in ./
views_revisions.module - Implements hook_menu().
File
- ./
views_revisions.module, line 208 - A module to provide revisions of Views.
Code
function views_revisions_revision_form($form, &$form_state, $vrvid) {
$row = db_query("\n SELECT vr.vrvid, vr.vid, vr.log, views_view.name\n FROM {views_revisions} AS vr\n LEFT JOIN {views_view} ON vr.vid = views_view.vid\n WHERE vr.vrvid = :vrvid\n ", array(
":vrvid" => $vrvid,
))
->fetchObject();
if (!$row) {
drupal_set_message(t('Could not find revision ID @vrvid', array(
"@vrvid" => $vrvid,
)), 'error');
return $form;
}
$form_state['vrvid'] = $row->vrvid;
$form_state['view'] = views_get_view($row->name);
if (!$form_state['view']) {
drupal_set_message(t('Could not find the view @name.', array(
"@name" => $row->name,
)), 'error');
}
else {
$form['title'] = array(
'#markup' => '<h2><code>' . check_plain($form_state['view']->name) . '</code></h2>',
);
}
$form['views_revisions_log'] = array(
'#type' => 'textarea',
'#title' => t('Revision log message'),
'#description' => t('Improve the explanation of the changes made. This will help other authors understand your motivations.'),
'#rows' => 3,
'#default_value' => $row->log,
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
return $form;
}