function advanced_link_widget_settings in Advanced Link 6
Implements hook_widget_settings().
File
- ./
advanced_link.module, line 202 - Defines simple advanced_link widget.
Code
function advanced_link_widget_settings($op, $widget) {
switch ($op) {
case 'form':
$form['urls_allowed'] = array(
'#type' => 'radios',
'#title' => t('URLs allowed'),
'#options' => array(
ADVANCED_LINK_INTERNAL => t('Allowed only internal.'),
ADVANCED_LINK_EXTERNAL => t('Allowed only external.'),
ADVANCED_LINK_BOTH => t('Allowed both (external and internal).'),
),
'#default_value' => isset($widget['urls_allowed']) ? $widget['urls_allowed'] : ADVANCED_LINK_BOTH,
'#description' => t('More filtering options can be found in "URLs filter" textfield.'),
);
$filter_description = t("Enter one page per line as Drupal paths or only another external. Note, that filtering applies to any 'URLs allowed' mode. The '*' character is a wildcard. Example paths are blog for the <em>blog</em> page and blog/* for every personal blog. %front is the front page.", array(
'%front' => '<front>',
));
$form['urls_filter'] = array(
'#type' => 'textarea',
'#title' => t('URLs filter'),
'#default_value' => isset($widget['urls_filter']) ? $widget['urls_filter'] : '',
'#description' => $filter_description,
);
$form['title_list'] = array(
'#type' => 'textarea',
'#title' => t('List of allowed titles'),
'#default_value' => isset($widget['title_list']) ? $widget['title_list'] : '',
'#description' => t("Enter the list of allowed titles separated by new line.<br />Leave empty to allow user input any text in title."),
);
$form['urls_search'] = array(
'#type' => 'radios',
'#title' => t('Suggest urls that'),
'#options' => array(
ADVANCED_LINK_SEARCH_START => t('start with specified characters'),
ADVANCED_LINK_SEARCH_CONTAINS => t('contain specified characters'),
),
'#default_value' => isset($settings['urls_search']) ? $settings['urls_search'] : ADVANCED_LINK_SEARCH_START,
'#description' => t('Select search type for autocomplete suggestion.'),
);
return $form;
case 'save':
return array(
'urls_filter',
'urls_allowed',
'title_list',
'urls_search',
);
}
}