function _ad_text_node_form in Advertisement 7
Adapi helper function for displaying a node form.
1 call to _ad_text_node_form()
- ad_text_adapi in text/
ad_text.module - Implementation of hook_adapi().
File
- text/
ad_text.module, line 256 - Enhances the ad module to support static text ads.
Code
function _ad_text_node_form(&$node) {
$form = array();
$form['ad_text'] = array(
'#type' => 'fieldset',
'#title' => t('Text'),
'#collapsible' => TRUE,
);
if (arg(1) == 'add' && user_access('create advertisements') || ad_permission($node->nid, 'manage ad text')) {
$access = TRUE;
}
else {
$access = FALSE;
$form['ad_text']['notice'] = array(
'#type' => 'markup',
'#value' => '<p>' . t('You do not have permission to edit this advertisement.') . '</p>',
);
}
$form['ad_text']['text'] = array(
'#type' => 'markup',
'#value' => ad_text_display_ad($node),
);
$form['ad_text']['url'] = array(
'#type' => 'textfield',
'#title' => t('Destination URL'),
'#maxlength' => 255,
'#default_value' => isset($node->url) ? $node->url : '',
'#description' => t('Enter the complete URL where you want people to be redirected when they click on this advertisement. The URL must be valid and begin with http:// or https://, for example %url, unless you !disable. If you do not enter a URL, the advertisement will not be clickable.', array(
'%url' => t('http://www.sample.org/'),
'!disable' => l(t('disable URL validation'), 'admin/content/ad/configure', array(
'fragment' => 'edit-ad-validate-url-wrapper',
)),
)),
'#disabled' => !$access,
);
$form['ad_text']['adheader'] = array(
'#type' => 'textfield',
'#title' => t('Ad header'),
'#required' => $access,
'#default_value' => isset($node->adheader) ? $node->adheader : '',
'#description' => t('This is the first line of the ad which will be linked to the URL entered above.'),
'#disabled' => !$access,
);
$form['ad_text']['adbody'] = array(
'#type' => 'textarea',
'#title' => t('Ad body'),
'#required' => $access,
'#default_value' => isset($node->adbody) ? $node->adbody : '',
'#description' => t('This is the rest of the ad.'),
'#disabled' => !$access,
);
return $form;
}