1111 *
1212 */
1313function easy_xmlsitemap_settings_form () {
14-
15- $ config = config ('easy_xmlsitemap.settings ' );
14+ $ config = config ('easy_xmlsitemap.settings ' );
1615 $ last_build_date = $ config ->get ('last_build_date ' );
1716
1817 $ info = $ last_build_date != 0
19- ? t ('Sitemap file last build time: ' ) . format_date ($ last_build_date , 'short ' )
20- : t ('Sitemap file has not built yet. ' );
18+ ? t ('Sitemap last build time: ' ) . format_date ($ last_build_date , 'short ' )
19+ : t ('Sitemap has not built yet. ' );
2120
21+ $ site_langs = language_list (TRUE , TRUE );
22+
2223 $ form = array ();
2324
2425 $ form ['build_info ' ] = array (
2526 '#type ' => 'fieldset ' ,
2627 '#title ' => t ('Sitemap build ' ),
2728 '#collapsible ' => TRUE ,
2829 '#collapsed ' => FALSE ,
29- );
30+ );
3031
3132 $ form ['build_info ' ]['info ' ] = array (
3233 '#markup ' => '<p> ' . $ info . '</p> ' ,
3334 );
34- $ form ['build_info ' ]['actions ' ] = array ('#type ' => 'actions ' );
35- $ form ['build_info ' ]['actions ' ]['build ' ] = array (
35+ $ form ['build_info ' ]['build ' ] = array (
3636 '#type ' => 'submit ' ,
3737 '#value ' => t ('Build sitemap now ' ),
38+ '#attributes ' => array (
39+ 'class ' => array ('button-primary ' ),
40+ ),
3841 );
3942 $ form ['build_info ' ]['actions ' ]['info ' ] = array (
40- '#markup ' => '<div class="description"> ' . t ('This will rebuild XML sitemap. ' ) . '</div> ' ,
43+ '#markup ' => '<div class="description"> ' . t ('This will rebuild sitemap immediately . ' ) . '</div> ' ,
4144 );
4245
4346 $ form ['settings ' ] = array (
4447 '#type ' => 'fieldset ' ,
45- '#title ' => t ('Settings ' ),
48+ '#title ' => t ('Advanced settings ' ),
4649 '#collapsible ' => TRUE ,
4750 '#collapsed ' => TRUE ,
4851 );
4952
5053 $ form ['settings ' ]['base_url ' ] = array (
5154 '#type ' => 'textfield ' ,
52- '#title ' => t ('Default base URL ' ),
55+ '#title ' => t ('Default base URL (optional) ' ),
5356 '#default_value ' => $ config ->get ('base_url ' ),
54- '#description ' => t ('Optional default base URL used for sitemaps and sitemap links, for example: http://example.com, can be left empty. ' ),
57+ '#description ' => t ('Optional replacement for base URL, should be used instead of actual domain for sitemap links, for example: http://example.com. In most cases can be left empty. ' ),
5558 );
5659 $ form ['settings ' ]['rebuild_frequency ' ] = array (
5760 '#type ' => 'select ' ,
@@ -68,37 +71,45 @@ function easy_xmlsitemap_settings_form() {
6871 '#type ' => 'textarea ' ,
6972 '#title ' => t ('Excluded URLs list (optional) ' ),
7073 '#default_value ' => $ config ->get ('excluded_urls ' ),
71- '#description ' => t ('If some URLs should be excluded from sitemap, place these URLs here, one URL per line without domain, for example: ' )
74+ '#description ' => t ('If some URLs should be excluded from sitemap, place these URLs here, one URL per line without domain, see an example below : ' )
7275 . '<br />403.html '
7376 . '<br />404.html '
7477 . '<br />node/123 '
7578 . '<br />some-test-page.html '
7679 );
77-
78- $ form ['settings ' ]['actions ' ] = array ('#type ' => 'actions ' );
79- $ form ['settings ' ]['actions ' ]['submit ' ] = array (
80+ if (count ($ site_langs ) > 1 ) {
81+ $ form ['settings ' ]['excluded_langs ' ] = array (
82+ '#type ' => 'checkboxes ' ,
83+ '#title ' => t ('Exclude from sitemap all pages for selected language (optional): ' ),
84+ '#options ' => $ site_langs ,
85+ '#default_value ' => $ config ->get ('excluded_langs ' ),
86+ '#description ' => t ('In some cases you might want do not include to sitemap links to pages for specific language. ' ),
87+ );
88+ }
89+ $ form ['settings ' ]['submit ' ] = array (
8090 '#type ' => 'submit ' ,
8191 '#value ' => t ('Save settings ' ),
92+ '#attributes ' => array (
93+ 'class ' => array ('button-primary ' ),
94+ ),
8295 );
8396
8497 return $ form ;
85-
8698}
8799
88100/**
89101 * Submit actions for form
90102 *
91103 */
92104function easy_xmlsitemap_settings_form_submit ($ form , &$ form_state ) {
93-
94105 global $ user ;
95106 $ config = config ('easy_xmlsitemap.settings ' );
96107
97108 if ($ form_state ['clicked_button ' ]['#id ' ] == 'edit-submit ' ) {
98-
99109 $ config ->set ('base_url ' , trim ($ form_state ['values ' ]['base_url ' ]));
100110 $ config ->set ('rebuild_frequency ' , $ form_state ['values ' ]['rebuild_frequency ' ]);
101111 $ config ->set ('excluded_urls ' , trim ($ form_state ['values ' ]['excluded_urls ' ]));
112+ $ config ->set ('excluded_langs ' , $ form_state ['values ' ]['excluded_langs ' ]);
102113
103114 $ config ->save ();
104115 watchdog ('easy_xmlsitemap ' , t ('Settings changed by @user. ' , array ('@user ' => $ user ->name )));
@@ -108,4 +119,3 @@ function easy_xmlsitemap_settings_form_submit($form, &$form_state) {
108119 easy_xmlsitemap_build ();
109120 }
110121}
111-
0 commit comments