You are here

function xmlsitemap_add_link_bundle_settings in XML sitemap 6.2

Same name and namespace in other branches
  1. 8 xmlsitemap.module \xmlsitemap_add_link_bundle_settings()
  2. 7.2 xmlsitemap.admin.inc \xmlsitemap_add_link_bundle_settings()
  3. 2.x xmlsitemap.module \xmlsitemap_add_link_bundle_settings()

Add the link type XML sitemap options to the link type's form.

Caller is responsible for ensuring xmlsitemap_link_bundle_settings_save() is called during submission.

5 calls to xmlsitemap_add_link_bundle_settings()
xmlsitemap_link_bundle_settings_form in ./xmlsitemap.admin.inc
xmlsitemap_menu_form_menu_edit_menu_alter in xmlsitemap_menu/xmlsitemap_menu.module
Implements hook_form_FORM_ID_alter().
xmlsitemap_node_form_node_type_form_alter in xmlsitemap_node/xmlsitemap_node.module
Implements hook_form_FORM_ID_alter().
xmlsitemap_taxonomy_form_taxonomy_form_vocabulary_alter in xmlsitemap_taxonomy/xmlsitemap_taxonomy.module
Implements hook_form_FORM_ID_alter().
xmlsitemap_user_form_user_admin_settings_alter in xmlsitemap_user/xmlsitemap_user.module
Implements hook_form_FORM_ID_alter().

File

./xmlsitemap.admin.inc, line 573
Administrative page callbacks for the xmlsitemap module.

Code

function xmlsitemap_add_link_bundle_settings(array &$form, array &$form_state, $entity, $bundle) {
  $entity_info = xmlsitemap_get_link_info($entity);
  $bundle_info = xmlsitemap_link_bundle_load($entity, $bundle);
  $form['xmlsitemap'] = array(
    '#type' => 'fieldset',
    '#title' => t('XML sitemap'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#access' => user_access('administer xmlsitemap'),
    '#group' => 'additional_settings',
    '#attached' => array(
      'js' => array(
        'vertical-tabs' => drupal_get_path('module', 'xmlsitemap') . '/xmlsitemap.js',
      ),
    ),
    '#tree' => TRUE,
    '#entity' => $entity,
    '#bundle' => $bundle,
    '#entity_info' => $entity_info,
    '#bundle_info' => $bundle_info,
  );
  $form['xmlsitemap']['description'] = array(
    '#prefix' => '<div class="description">',
    '#suffix' => '</div>',
    '#value' => t('Changing these type settings will affect any items of this type that have either inclusion or priority set to default.'),
  );
  $form['xmlsitemap']['status'] = array(
    '#type' => 'select',
    '#title' => t('Inclusion'),
    '#options' => xmlsitemap_get_status_options(),
    '#default_value' => $bundle_info['status'],
  );
  $form['xmlsitemap']['priority'] = array(
    '#type' => 'select',
    '#title' => t('Default priority'),
    '#options' => xmlsitemap_get_priority_options(),
    '#default_value' => $bundle_info['priority'],
    '#process' => array(
      'form_expand_ahah',
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-xmlsitemap-status' => array(
        1,
      ),
    ),
  );

  // Hide the priority field if the link is excluded.
  if (module_exists('ctools')) {
    ctools_include('dependent');
  }
  $form += array(
    '#submit' => array(),
  );
  array_unshift($form['#submit'], 'xmlsitemap_link_bundle_settings_form_submit');
  if (isset($form['submit'])) {
    $form['submit'] += array(
      '#weight' => 40,
    );
  }
  if (isset($form['delete'])) {
    $form['delete'] += array(
      '#weight' => 50,
    );
  }
}