option_nfs_cancel.inc in Node and Comments Form Settings 7.3
File
includes/option_nfs_cancel.inc
View source
<?php
function _option_nfs_cancel(&$form, &$form_state, $settings, $node) {
if ($settings['nfs_cancel']['nfs_cancel_status'] == 0) {
if (isset($settings['nfs_cancel']['nfs_cancel_behaviour'])) {
switch ($settings['nfs_cancel']['nfs_cancel_behaviour']) {
case 0:
$form['actions']['cancel'] = array(
'#markup' => '<a class="form-button form-button-cancel" rel="nofollow" href="javascript: history.go(-1)" title="' . t('Cancel') . '" alt="' . t('Cancel') . '">' . t('Cancel') . '</a>',
'#weight' => 51,
);
break;
case 1:
if (!isset($_GET['destination']) || $_GET['destination'] == $_GET['q']) {
$url['path'] = !empty($node->nid) ? 'node/' . $node->nid : '<front>';
}
else {
$url = parse_url($_GET['destination']);
}
$form['actions']['cancel'] = array(
'#markup' => l(t('Cancel'), $url['path'], array(
'query' => isset($url['query']) ? $url['query'] : '',
'fragment' => isset($url['fragment']) ? $url['fragment'] : '',
'attributes' => array(
'class' => 'form-button form-button-cancel',
'rel' => 'nofollow',
),
)),
'#weight' => 51,
);
break;
}
}
}
return $form;
}