Adding bundles to your xml sitemap the easy way

Adding bundles to your xml sitemap the easy way

أفكار لربح المال من المنزل If you have ever had to configure the Drupal xmlsitemap module for a site with lots of content types, vocabularies or any other entity types you know how frustrating and tedious it is having to edit each one of these bundle through it's own edit page to have it included in the sitemap. 

مراجعتي هنا

الإستطلاعات على الإنترنت لكسب المال Having recently had about 10 sites who's sitemap settings had all been neglected and with each site having over 20 content types and other bundles that were supposed to have been added to the sitemaps I decided to make a module so I can do this all from a single page with a single form.

برنامج فوركس ما هي شروطه There is no option to set the priority of each bundle on the form as this was not my concern and this is not being submitted to Drupal. org but apart from that this module uses as much of the xmlsitemap modules functions as possible so there is very little code but this has saved me allot of time clicking buttons and links needlessly. 

انقر للتحقيق

موارد إضافية There are Drupal 6 & 7 versions available in my github in the Modules repo, the code below if the Drupal 7 version of the module.

موقع مفيد <?php   /** * @file * Provides a method or adding or excluding all the available items to your * sitemap from one page */   /** * implements hook_menu(); * * @return array */ function xmlsitemap_bulk_update_menu() { $items['admin/config/search/xmlsitemap/bulk-update'] = array( 'title' => 'Bulk Update', 'page callback' => 'drupal_get_form', 'page arguments' => array('xmlsitemap_bulk_update_settings_form'), 'access arguments' => array('administer xmlsitemap'), 'type' => MENU_LOCAL_TASK, );   return $items; }   /** * Implements hook_form(); */ function xmlsitemap_bulk_update_settings_form() { $entities = xmlsitemap_get_link_info(NULL, TRUE); module_load_all_includes('inc', 'xmlsitemap'); foreach ($entities as $entity => $entity_info) { $form[$entity] = array( '#type' => 'fieldset', '#title' => $entity_info['label'], '#collapsible' => false, '#group' => 'xmlsitemap_settings', );   if (!empty($entity_info['bundles'])) { foreach ($entity_info['bundles'] as $bundle => $bundle_info) { $status = $bundle_info['xmlsitemap']['status']; $form[$entity][$entity . '|' . $bundle] = xmlsitemap_bulk_update_get_checkbox($bundle_info['label'], $status); } }   $form[$entity]['#access'] = (bool) element_get_visible_children($form[$entity]); }   $form['submit'] = array( '#type' => 'submit', '#value' => t("Bulk Update :)"), );   return $form; }   /** * Returns a simple checkbox element array * * @param string $title * @param string $status * @return array */ function xmlsitemap_bulk_update_get_checkbox($title, $status) { return array( '#type' => 'checkbox', '#title' => $title, '#default_value' => $status, ); }   /** * Implements hook_form_submit(); * * Calls the xmlsitemap_link_bundle_settings_save function to include or * exclude each available item in the sitemap * * @param array $form * @param array $form_state */ function xmlsitemap_bulk_update_settings_form_submit(&$form, &$form_state) { $values = $form_state['values']; foreach ($values as $key => $value) { if (mb_strpos($key, '|', 0) !== FALSE) { $entitiy_info = explode('|', $key); $settings = array( 'status' => (string) $value, 'priority' => '0.5', ); xmlsitemap_link_bundle_settings_save($entitiy_info[0], $entitiy_info[1], $settings, TRUE); } } }


Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.