You are here

function advanced_link_field_widget_settings_form in Advanced Link 7

Implements hook_field_widget_settings_form().

File

./advanced_link.module, line 176
Defines simple advanced_link widget.

Code

function advanced_link_field_widget_settings_form($field, $instance) {
  $form = array();
  $widget = $instance['widget'];
  $settings = $widget['settings'];
  $form['urls_allowed'] = array(
    "#weight" => -10,
    '#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($settings['urls_allowed']) ? $settings['urls_allowed'] : ADVANCED_LINK_BOTH,
    '#description' => t('More filtering options can be found in "URLs filter" textfield.'),
  );
  $form['urls_filter'] = array(
    "#weight" => -9,
    '#type' => 'textarea',
    '#title' => t('URLs filter'),
    '#default_value' => isset($settings['urls_filter']) ? $settings['urls_filter'] : '',
    '#description' => t('Enter the list of allowed urls separated by new line.<br />Leave empty to allow user input any urls.<br />The "*" character is a wildcard.<br />Example paths: blog for the <em>blog</em> page, blog/* for every personal blog, facebook.com/* for any page on Facebook site.'),
  );
  $form['default_titles'] = array(
    "#weight" => -9,
    '#type' => 'textarea',
    '#title' => t('List of allowed titles'),
    '#default_value' => isset($settings['default_titles']) ? $settings['default_titles'] : '',
    '#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(
    "#weight" => -9,
    '#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;
}