-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme-settings.php
888 lines (851 loc) · 43.5 KB
/
theme-settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
<?php
// $Id: theme-settings.php,v 1.1 2009/07/19 18:14:52 garthee Exp $
/**
* Implementation of THEMEHOOK_settings() function.
*
* @param $saved_settings
* array An array of saved settings for this theme.
* @return
* array A form array.
*/
function phptemplate_settings($saved_settings) {
// Get the node types
$node_types = node_get_types('names');
/**
* The default values for the theme variables. Make sure $defaults exactly
* matches the $defaults in the template.php file.
*/
$defaults = array(
'user_notverified_display' => 1,
'breadcrumb_display' => 0,
'banner_display' => 0,
'iepngfix_display' => 0,
'colorswitch_display' => 0,
'suckerfish_display' => 0,
'foreground_bg' => 0,
'background_bg' => 0,
'foreground_border' => 0,
'background_border' => 0,
'foreground_font' => 0,
'background_font' => 0,
'search_snippet' => 1,
'search_info_type' => 1,
'search_info_user' => 1,
'search_info_date' => 1,
'search_info_comment' => 1,
'search_info_upload' => 1,
'mission_statement_pages' => 'home',
'front_page_title_display' => 'title_slogan',
'page_title_display_custom' => '',
'other_page_title_display' => 'ptitle_slogan',
'other_page_title_display_custom' => '',
'configurable_separator' => ' | ',
'meta_keywords' => '',
'meta_description' => '',
'taxonomy_display_default' => 'only',
'taxonomy_format_default' => 'vocab',
'taxonomy_enable_content_type' => 0,
'submitted_by_author_default' => 1,
'submitted_by_date_default' => 1,
'submitted_by_enable_content_type' => 0,
'readmore_default' => t('Read more'),
'readmore_title_default' => t('Read the rest of this posting.'),
'readmore_prefix_default' => '',
'readmore_suffix_default' => '',
'readmore_enable_content_type' => 0,
'comment_singular_default' => t('1 comment'),
'comment_plural_default' => t('@count comments'),
'comment_title_default' => t('Jump to the first comment of this posting.'),
'comment_prefix_default' => '',
'comment_suffix_default' => '',
'comment_new_singular_default' => t('1 new comment'),
'comment_new_plural_default' => t('@count new comments'),
'comment_new_title_default' => t('Jump to the first new comment of this posting.'),
'comment_new_prefix_default' => '',
'comment_new_suffix_default' => '',
'comment_add_default' => t('Add new comment'),
'comment_add_title_default' => t('Add a new comment to this page.'),
'comment_add_prefix_default' => '',
'comment_add_suffix_default' => '',
'comment_node_default' => t('Add new comment'),
'comment_node_title_default' => t('Share your thoughts and opinions related to this posting.'),
'comment_node_prefix_default' => '',
'comment_node_suffix_default' => '',
'comment_enable_content_type' => 0,
);
// Make the default content-type settings the same as the default theme settings,
// so we can tell if content-type-specific settings have been altered.
$defaults = array_merge($defaults, theme_get_settings());
// Set the default values for content-type-specific settings
foreach ($node_types as $type => $name) {
$defaults["taxonomy_display_{$type}"] = $defaults['taxonomy_display_default'];
$defaults["taxonomy_format_{$type}"] = $defaults['taxonomy_format_default'];
$defaults["submitted_by_author_{$type}"] = $defaults['submitted_by_author_default'];
$defaults["submitted_by_date_{$type}"] = $defaults['submitted_by_date_default'];
$defaults["readmore_{$type}"] = $defaults['readmore_default'];
$defaults["readmore_title_{$type}"] = $defaults['readmore_title_default'];
$defaults["readmore_prefix_{$type}"] = $defaults['readmore_prefix_default'];
$defaults["readmore_suffix_{$type}"] = $defaults['readmore_suffix_default'];
$defaults["comment_singular_{$type}"] = $defaults['comment_singular_default'];
$defaults["comment_plural_{$type}"] = $defaults['comment_plural_default'];
$defaults["comment_title_{$type}"] = $defaults['comment_title_default'];
$defaults["comment_prefix_{$type}"] = $defaults['comment_prefix_default'];
$defaults["comment_suffix_{$type}"] = $defaults['comment_suffix_default'];
$defaults["comment_new_singular_{$type}"] = $defaults['comment_new_singular_default'];
$defaults["comment_new_plural_{$type}"] = $defaults['comment_new_plural_default'];
$defaults["comment_new_title_{$type}"] = $defaults['comment_new_title_default'];
$defaults["comment_new_prefix_{$type}"] = $defaults['comment_new_prefix_default'];
$defaults["comment_new_suffix_{$type}"] = $defaults['comment_new_suffix_default'];
$defaults["comment_add_{$type}"] = $defaults['comment_add_default'];
$defaults["comment_add_title_{$type}"] = $defaults['comment_add_title_default'];
$defaults["comment_add_prefix_{$type}"] = $defaults['comment_add_prefix_default'];
$defaults["comment_add_suffix_{$type}"] = $defaults['comment_add_suffix_default'];
$defaults["comment_node_{$type}"] = $defaults['comment_node_default'];
$defaults["comment_node_title_{$type}"] = $defaults['comment_node_title_default'];
$defaults["comment_node_prefix_{$type}"] = $defaults['comment_node_prefix_default'];
$defaults["comment_node_suffix_{$type}"] = $defaults['comment_node_suffix_default'];
}
// Merge the saved variables and their default values
$settings = array_merge($defaults, $saved_settings);
// If content type-specifc settings are not enabled, reset the values
if ($settings['readmore_enable_content_type'] == 0) {
foreach ($node_types as $type => $name) {
$settings["readmore_{$type}"] = $settings['readmore_default'];
$settings["readmore_title_{$type}"] = $settings['readmore_title_default'];
$settings["readmore_prefix_{$type}"] = $settings['readmore_prefix_default'];
$settings["readmore_suffix_{$type}"] = $settings['readmore_suffix_default'];
}
}
if ($settings['comment_enable_content_type'] == 0) {
foreach ($node_types as $type => $name) {
$defaults["comment_singular_{$type}"] = $defaults['comment_singular_default'];
$defaults["comment_plural_{$type}"] = $defaults['comment_plural_default'];
$defaults["comment_title_{$type}"] = $defaults['comment_title_default'];
$defaults["comment_prefix_{$type}"] = $defaults['comment_prefix_default'];
$defaults["comment_suffix_{$type}"] = $defaults['comment_suffix_default'];
$defaults["comment_new_singular_{$type}"] = $defaults['comment_new_singular_default'];
$defaults["comment_new_plural_{$type}"] = $defaults['comment_new_plural_default'];
$defaults["comment_new_title_{$type}"] = $defaults['comment_new_title_default'];
$defaults["comment_new_prefix_{$type}"] = $defaults['comment_new_prefix_default'];
$defaults["comment_new_suffix_{$type}"] = $defaults['comment_new_suffix_default'];
$defaults["comment_add_{$type}"] = $defaults['comment_add_default'];
$defaults["comment_add_title_{$type}"] = $defaults['comment_add_title_default'];
$defaults["comment_add_prefix_{$type}"] = $defaults['comment_add_prefix_default'];
$defaults["comment_add_suffix_{$type}"] = $defaults['comment_add_suffix_default'];
$defaults["comment_node_{$type}"] = $defaults['comment_node_default'];
$defaults["comment_node_title_{$type}"] = $defaults['comment_node_title_default'];
$defaults["comment_node_prefix_{$type}"] = $defaults['comment_node_prefix_default'];
$defaults["comment_node_suffix_{$type}"] = $defaults['comment_node_suffix_default'];
}
}
// Create theme settings form widgets using Forms API
// TNT Fieldset
$form['tnt_container'] = array(
'#type' => 'fieldset',
'#title' => t('m4Music settings'),
'#description' => t('Use these settings to change what and how information is displayed in your theme.'),
'#collapsible' => TRUE,
'#collapsed' => false,
);
// General Settings
$form['tnt_container']['general_settings'] = array(
'#type' => 'fieldset',
'#title' => t('General settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
// Mission Statement
$form['tnt_container']['general_settings']['mission_statement'] = array(
'#type' => 'fieldset',
'#title' => t('Mission statement'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['general_settings']['mission_statement']['mission_statement_pages'] = array(
'#type' => 'radios',
'#title' => t('Where should your mission statement be displayed?'),
'#default_value' => $settings['mission_statement_pages'],
'#options' => array(
'home' => t('Display mission statement only on front page'),
'all' => t('Display mission statement on all pages'),
),
);
// ImageCache Settings
if (module_exists('imagecache')) {
m4music_add_imagecache_preset();
// Banner Images with imagecache
$form['tnt_container']['general_settings']['banner'] = array(
'#type' => 'fieldset',
'#title' => t('Banner Images'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['general_settings']['banner']['banner_display'] = array(
'#type' => 'checkbox',
'#title' => t('Display Banner with imagecache'),
'#default_value' => $settings['banner_display'],
);
}
// Breadcrumb
$form['tnt_container']['general_settings']['breadcrumb'] = array(
'#type' => 'fieldset',
'#title' => t('Breadcrumb'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['general_settings']['breadcrumb']['breadcrumb_display'] = array(
'#type' => 'checkbox',
'#title' => t('Display breadcrumb'),
'#default_value' => $settings['breadcrumb_display'],
);
// iepngfix
$form['tnt_container']['general_settings']['iepngfix'] = array(
'#type' => 'fieldset',
'#title' => t('IE PNG Fix'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['general_settings']['iepngfix']['iepngfix_display'] = array(
'#type' => 'checkbox',
'#title' => t('Use IE PNG Fix'),
'#default_value' => $settings['iepngfix_display'],
);
// colorswitch
$form['tnt_container']['general_settings']['colorswitch'] = array(
'#type' => 'fieldset',
'#title' => t('Color Switcher'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['general_settings']['colorswitch']['colorswitch_display'] = array(
'#type' => 'checkbox',
'#title' => t('Use Color Switch'),
'#default_value' => $settings['colorswitch_display'],
);
// colorswitch foreground
$form['tnt_container']['general_settings']['colorswitch']['foreground'] = array(
'#type' => 'fieldset',
'#title' => t('Foreground Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['general_settings']['colorswitch']['foreground']['foreground_bg'] = array(
'#type' => 'textfield',
'#title' => t('Background Color'),
'#default_value' => $settings['foreground_bg'],
'#description' => t('Color to use as background. Use #FFF notation.'),
);
$form['tnt_container']['general_settings']['colorswitch']['foreground']['foreground_border'] = array(
'#type' => 'textfield',
'#title' => t('Border Color'),
'#default_value' => $settings['foreground_border'],
'#description' => t('Color to use for borders. Use #FFF notation.'),
);
$form['tnt_container']['general_settings']['colorswitch']['foreground']['foreground_font'] = array(
'#type' => 'textfield',
'#title' => t('Font Color'),
'#default_value' => $settings['foreground_font'],
'#description' => t('Color to use for font. Use #FFF notation.'),
);
// colorswitch background
$form['tnt_container']['general_settings']['colorswitch']['background'] = array(
'#type' => 'fieldset',
'#title' => t('Background Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['general_settings']['colorswitch']['background']['background_bg'] = array(
'#type' => 'textfield',
'#title' => t('Background Color'),
'#default_value' => $settings['background_bg'],
'#description' => t('Color to use as background. Use #FFF notation.'),
);
$form['tnt_container']['general_settings']['colorswitch']['background']['background_border'] = array(
'#type' => 'textfield',
'#title' => t('Border Color'),
'#default_value' => $settings['background_border'],
'#description' => t('Color to use for borders. Use #FFF notation.'),
);
$form['tnt_container']['general_settings']['colorswitch']['background']['background_font'] = array(
'#type' => 'textfield',
'#title' => t('Font Color'),
'#default_value' => $settings['background_font'],
'#description' => t('Color to use for font. Use #FFF notation.'),
);
// suckerfish
$form['tnt_container']['general_settings']['suckerfish'] = array(
'#type' => 'fieldset',
'#title' => t('Suckerfish Menus'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['general_settings']['suckerfish']['suckerfish_display'] = array(
'#type' => 'checkbox',
'#title' => t('Use Suckerfish Menus'),
'#default_value' => $settings['suckerfish_display'],
);
// Username
$form['tnt_container']['general_settings']['username'] = array(
'#type' => 'fieldset',
'#title' => t('Username'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['general_settings']['username']['user_notverified_display'] = array(
'#type' => 'checkbox',
'#title' => t('Display "not verified" for unregistered usernames'),
'#default_value' => $settings['user_notverified_display'],
);
// Search Settings
$form['tnt_container']['general_settings']['search_container'] = array(
'#type' => 'fieldset',
'#title' => t('Search results'),
'#description' => t('What additional information should be displayed on your search results page?'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['general_settings']['search_container']['search_results']['search_snippet'] = array(
'#type' => 'checkbox',
'#title' => t('Display text snippet'),
'#default_value' => $settings['search_snippet'],
);
$form['tnt_container']['general_settings']['search_container']['search_results']['search_info_type'] = array(
'#type' => 'checkbox',
'#title' => t('Display content type'),
'#default_value' => $settings['search_info_type'],
);
$form['tnt_container']['general_settings']['search_container']['search_results']['search_info_user'] = array(
'#type' => 'checkbox',
'#title' => t('Display author name'),
'#default_value' => $settings['search_info_user'],
);
$form['tnt_container']['general_settings']['search_container']['search_results']['search_info_date'] = array(
'#type' => 'checkbox',
'#title' => t('Display posted date'),
'#default_value' => $settings['search_info_date'],
);
$form['tnt_container']['general_settings']['search_container']['search_results']['search_info_comment'] = array(
'#type' => 'checkbox',
'#title' => t('Display comment count'),
'#default_value' => $settings['search_info_comment'],
);
$form['tnt_container']['general_settings']['search_container']['search_results']['search_info_upload'] = array(
'#type' => 'checkbox',
'#title' => t('Display attachment count'),
'#default_value' => $settings['search_info_upload'],
);
// Node Settings
$form['tnt_container']['node_type_specific'] = array(
'#type' => 'fieldset',
'#title' => t('Node settings'),
'#description' => t('Here you can make adjustments to which information is shown with your content, and how it is displayed. You can modify these settings so they apply to all content types, or check the "Use content-type specific settings" box to customize them for each content type. For example, you may want to show the date on stories, but not pages.'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
// Author & Date Settings
$form['tnt_container']['node_type_specific']['submitted_by_container'] = array(
'#type' => 'fieldset',
'#title' => t('Author & date'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// Default & content-type specific settings
foreach ((array('default' => 'Default') + node_get_types('names')) as $type => $name) {
$form['tnt_container']['node_type_specific']['submitted_by_container']['submitted_by'][$type] = array(
'#type' => 'fieldset',
'#title' => t('!name', array('!name' => t($name))),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['submitted_by_container']['submitted_by'][$type]["submitted_by_author_{$type}"] = array(
'#type' => 'checkbox',
'#title' => t('Display author\'s username'),
'#default_value' => $settings["submitted_by_author_{$type}"],
);
$form['tnt_container']['node_type_specific']['submitted_by_container']['submitted_by'][$type]["submitted_by_date_{$type}"] = array(
'#type' => 'checkbox',
'#title' => t('Display date posted (you can customize this format on your Date and Time settings page)'),
'#default_value' => $settings["submitted_by_date_{$type}"],
);
// Options for default settings
if ($type == 'default') {
$form['tnt_container']['node_type_specific']['submitted_by_container']['submitted_by']['default']['#title'] = t('Default');
$form['tnt_container']['node_type_specific']['submitted_by_container']['submitted_by']['default']['#collapsed'] = $settings['submitted_by_enable_content_type'] ? TRUE : FALSE;
$form['tnt_container']['node_type_specific']['submitted_by_container']['submitted_by']['submitted_by_enable_content_type'] = array(
'#type' => 'checkbox',
'#title' => t('Use custom settings for each content type instead of the default above'),
'#default_value' => $settings['submitted_by_enable_content_type'],
);
}
// Collapse content-type specific settings if default settings are being used
else if ($settings['submitted_by_enable_content_type'] == 0) {
$form['submitted_by'][$type]['#collapsed'] = TRUE;
}
}
// Taxonomy Settings
if (module_exists('taxonomy')) {
$form['tnt_container']['node_type_specific']['display_taxonomy_container'] = array(
'#type' => 'fieldset',
'#title' => t('Taxonomy terms'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// Default & content-type specific settings
foreach ((array('default' => 'Default') + node_get_types('names')) as $type => $name) {
// taxonomy display per node
$form['tnt_container']['node_type_specific']['display_taxonomy_container']['display_taxonomy'][$type] = array(
'#type' => 'fieldset',
'#title' => t('!name', array('!name' => t($name))),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// display
$form['tnt_container']['node_type_specific']['display_taxonomy_container']['display_taxonomy'][$type]["taxonomy_display_{$type}"] = array(
'#type' => 'select',
'#title' => t('When should taxonomy terms be displayed?'),
'#default_value' => $settings["taxonomy_display_{$type}"],
'#options' => array(
'' => '',
'never' => t('Never display taxonomy terms'),
'all' => t('Always display taxonomy terms'),
'only' => t('Only display taxonomy terms on full node pages'),
),
);
// format
$form['tnt_container']['node_type_specific']['display_taxonomy_container']['display_taxonomy'][$type]["taxonomy_format_{$type}"] = array(
'#type' => 'radios',
'#title' => t('Taxonomy display format'),
'#default_value' => $settings["taxonomy_format_{$type}"],
'#options' => array(
'vocab' => t('Display each vocabulary on a new line'),
'list' => t('Display all taxonomy terms together in single list'),
),
);
// Get taxonomy vocabularies by node type
$vocabs = array();
$vocabs_by_type = ($type == 'default') ? taxonomy_get_vocabularies() : taxonomy_get_vocabularies($type);
foreach ($vocabs_by_type as $key => $value) {
$vocabs[$value->vid] = $value->name;
}
// Display taxonomy checkboxes
foreach ($vocabs as $key => $vocab_name) {
$form['tnt_container']['node_type_specific']['display_taxonomy_container']['display_taxonomy'][$type]["taxonomy_vocab_display_{$type}_{$key}"] = array(
'#type' => 'checkbox',
'#title' => t('Display vocabulary: '. $vocab_name),
'#default_value' => $settings["taxonomy_vocab_display_{$type}_{$key}"],
);
}
// Options for default settings
if ($type == 'default') {
$form['tnt_container']['node_type_specific']['display_taxonomy_container']['display_taxonomy']['default']['#title'] = t('Default');
$form['tnt_container']['node_type_specific']['display_taxonomy_container']['display_taxonomy']['default']['#collapsed'] = $settings['taxonomy_enable_content_type'] ? TRUE : FALSE;
$form['tnt_container']['node_type_specific']['display_taxonomy_container']['display_taxonomy']['taxonomy_enable_content_type'] = array(
'#type' => 'checkbox',
'#title' => t('Use custom settings for each content type instead of the default above'),
'#default_value' => $settings['taxonomy_enable_content_type'],
);
}
// Collapse content-type specific settings if default settings are being used
else if ($settings['taxonomy_enable_content_type'] == 0) {
$form['display_taxonomy'][$type]['#collapsed'] = TRUE;
}
}
}
// Read More & Comment Link Settings
$form['tnt_container']['node_type_specific']['link_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Links'),
'#description' => t('Customize the text of node links'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// Read more link settings
$form['tnt_container']['node_type_specific']['link_settings']['readmore'] = array(
'#type' => 'fieldset',
'#title' => t('“Read more”'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// Default & content-type specific settings
foreach ((array('default' => 'Default') + node_get_types('names')) as $type => $name) {
// Read more
$form['tnt_container']['node_type_specific']['link_settings']['readmore'][$type] = array(
'#type' => 'fieldset',
'#title' => t('!name', array('!name' => t($name))),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['readmore'][$type]["readmore_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Link text'),
'#default_value' => $settings["readmore_{$type}"],
'#description' => t('HTML is allowed.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['readmore'][$type]["readmore_title_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Title text (tool tip)'),
'#default_value' => $settings["readmore_title_{$type}"],
'#description' => t('Displayed when hovering over link. Plain text only.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['readmore'][$type]["readmore_prefix_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Prefix'),
'#default_value' => $settings["readmore_prefix_{$type}"],
'#description' => t('Text or HTML placed before the link.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['readmore'][$type]["readmore_suffix_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Suffix'),
'#default_value' => $settings["readmore_suffix_{$type}"],
'#description' => t('Text or HTML placed after the link.'),
);
// Options for default settings
if ($type == 'default') {
$form['tnt_container']['node_type_specific']['link_settings']['readmore']['default']['#title'] = t('Default');
$form['tnt_container']['node_type_specific']['link_settings']['readmore']['default']['#collapsed'] = $settings['readmore_enable_content_type'] ? TRUE : FALSE;
$form['tnt_container']['node_type_specific']['link_settings']['readmore']['readmore_enable_content_type'] = array(
'#type' => 'checkbox',
'#title' => t('Use custom settings for each content type instead of the default above'),
'#default_value' => $settings['readmore_enable_content_type'],
);
}
// Collapse content-type specific settings if default settings are being used
else if ($settings['readmore_enable_content_type'] == 0) {
$form['readmore'][$type]['#collapsed'] = TRUE;
}
}
// Comments link settings
$form['tnt_container']['node_type_specific']['link_settings']['comment'] = array(
'#type' => 'fieldset',
'#title' => t('“Comment”'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// Default & content-type specific settings
foreach ((array('default' => 'Default') + node_get_types('names')) as $type => $name) {
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type] = array(
'#type' => 'fieldset',
'#title' => t('!name', array('!name' => t($name))),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// Full nodes
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['node'] = array(
'#type' => 'fieldset',
'#title' => t('For full content'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['node']['add'] = array(
'#type' => 'fieldset',
'#title' => t('“Add new comment” link'),
'#description' => t('The link when the full content is being displayed.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['node']['add']["comment_node_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Link text'),
'#default_value' => $settings["comment_node_{$type}"],
'#description' => t('HTML is allowed.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['node']['add']["comment_node_title_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Title text (tool tip)'),
'#default_value' => $settings["comment_node_title_{$type}"],
'#description' => t('Displayed when hovering over link. Plain text only.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['node']['add']['extra'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['node']['add']['extra']["comment_node_prefix_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Prefix'),
'#default_value' => $settings["comment_node_prefix_{$type}"],
'#description' => t('Text or HTML placed before the link.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['node']['add']['extra']["comment_node_suffix_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Suffix'),
'#default_value' => $settings["comment_node_suffix_{$type}"],
'#description' => t('Text or HTML placed after the link.'),
);
// Teasers
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser'] = array(
'#type' => 'fieldset',
'#title' => t('For teasers'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['add'] = array(
'#type' => 'fieldset',
'#title' => t('“Add new comment” link'),
'#description' => t('The link when there are no comments.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['add']["comment_add_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Link text'),
'#default_value' => $settings["comment_add_{$type}"],
'#description' => t('HTML is allowed.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['add']["comment_add_title_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Title text (tool tip)'),
'#default_value' => $settings["comment_add_title_{$type}"],
'#description' => t('Displayed when hovering over link. Plain text only.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['add']['extra'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['add']['extra']["comment_add_prefix_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Prefix'),
'#default_value' => $settings["comment_add_prefix_{$type}"],
'#description' => t('Text or HTML placed before the link.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['add']['extra']["comment_add_suffix_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Suffix'),
'#default_value' => $settings["comment_add_suffix_{$type}"],
'#description' => t('Text or HTML placed after the link.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['standard'] = array(
'#type' => 'fieldset',
'#title' => t('“Comments” link'),
'#description' => t('The link when there are one or more comments.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['standard']["comment_singular_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Link text when there is 1 comment'),
'#default_value' => $settings["comment_singular_{$type}"],
'#description' => t('HTML is allowed.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['standard']["comment_plural_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Link text when there are multiple comments'),
'#default_value' => $settings["comment_plural_{$type}"],
'#description' => t('HTML is allowed. @count will be replaced with the number of comments.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['standard']["comment_title_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Title text (tool tip)'),
'#default_value' => $settings["comment_title_{$type}"],
'#description' => t('Displayed when hovering over link. Plain text only.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['standard']['extra'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['standard']['extra']["comment_prefix_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Prefix'),
'#default_value' => $settings["comment_prefix_{$type}"],
'#description' => t('Text or HTML placed before the link.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['standard']['extra']["comment_suffix_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Suffix'),
'#default_value' => $settings["comment_suffix_{$type}"],
'#description' => t('Text or HTML placed after the link.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['new'] = array(
'#type' => 'fieldset',
'#title' => t('“New comments” link'),
'#description' => t('The link when there are one or more new comments.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['new']["comment_new_singular_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Link text when there is 1 new comment'),
'#default_value' => $settings["comment_new_singular_{$type}"],
'#description' => t('HTML is allowed.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['new']["comment_new_plural_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Link text when there are multiple new comments'),
'#default_value' => $settings["comment_new_plural_{$type}"],
'#description' => t('HTML is allowed. @count will be replaced with the number of comments.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['new']["comment_new_title_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Title text (tool tip)'),
'#default_value' => $settings["comment_new_title_{$type}"],
'#description' => t('Displayed when hovering over link. Plain text only.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['new']['extra'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['new']['extra']["comment_new_prefix_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Prefix'),
'#default_value' => $settings["comment_new_prefix_{$type}"],
'#description' => t('Text or HTML placed before the link.'),
);
$form['tnt_container']['node_type_specific']['link_settings']['comment'][$type]['teaser']['new']['extra']["comment_new_suffix_{$type}"] = array(
'#type' => 'textfield',
'#title' => t('Suffix'),
'#default_value' => $settings["comment_new_suffix_{$type}"],
'#description' => t('Text or HTML placed after the link.'),
);
// Options for default settings
if ($type == 'default') {
$form['tnt_container']['node_type_specific']['link_settings']['comment']['default']['#title'] = t('Default');
$form['tnt_container']['node_type_specific']['link_settings']['comment']['default']['#collapsed'] = $settings['comment_enable_content_type'] ? TRUE : FALSE;
$form['tnt_container']['node_type_specific']['link_settings']['comment']['comment_enable_content_type'] = array(
'#type' => 'checkbox',
'#title' => t('Use custom settings for each content type instead of the default above'),
'#default_value' => $settings['comment_enable_content_type'],
);
}
// Collapse content-type specific settings if default settings are being used
else if ($settings['comment_enable_content_type'] == 0) {
$form['comment'][$type]['#collapsed'] = TRUE;
}
}
// SEO settings
$form['tnt_container']['seo'] = array(
'#type' => 'fieldset',
'#title' => t('Search engine optimization (SEO) settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
// Page titles
$form['tnt_container']['seo']['page_format_titles'] = array(
'#type' => 'fieldset',
'#title' => t('Page titles'),
'#description' => t('This is the title that displays in the title bar of your web browser. Your site title, slogan, and mission can all be set on your Site Information page'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// front page title
$form['tnt_container']['seo']['page_format_titles']['front_page_format_titles'] = array(
'#type' => 'fieldset',
'#title' => t('Front page title'),
'#description' => t('Your front page in particular should have important keywords for your site in the page title'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['seo']['page_format_titles']['front_page_format_titles']['front_page_title_display'] = array(
'#type' => 'select',
'#title' => t('Set text of front page title'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#default_value' => $settings['front_page_title_display'],
'#options' => array(
'title_slogan' => t('Site title | Site slogan'),
'slogan_title' => t('Site slogan | Site title'),
'title_mission' => t('Site title | Site mission'),
'custom' => t('Custom (below)'),
),
);
$form['tnt_container']['seo']['page_format_titles']['front_page_format_titles']['page_title_display_custom'] = array(
'#type' => 'textfield',
'#title' => t('Custom'),
'#size' => 60,
'#default_value' => $settings['page_title_display_custom'],
'#description' => t('Enter a custom page title for your front page'),
);
// other pages title
$form['tnt_container']['seo']['page_format_titles']['other_page_format_titles'] = array(
'#type' => 'fieldset',
'#title' => t('Other page titles'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['tnt_container']['seo']['page_format_titles']['other_page_format_titles']['other_page_title_display'] = array(
'#type' => 'select',
'#title' => t('Set text of other page titles'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#default_value' => $settings['other_page_title_display'],
'#options' => array(
'ptitle_slogan' => t('Page title | Site slogan'),
'ptitle_stitle' => t('Page title | Site title'),
'ptitle_smission' => t('Page title | Site mission'),
'ptitle_custom' => t('Page title | Custom (below)'),
'custom' => t('Custom (below)'),
),
);
$form['tnt_container']['seo']['page_format_titles']['other_page_format_titles']['other_page_title_display_custom'] = array(
'#type' => 'textfield',
'#title' => t('Custom'),
'#size' => 60,
'#default_value' => $settings['other_page_title_display_custom'],
'#description' => t('Enter a custom page title for all other pages'),
);
// SEO configurable separator
$form['tnt_container']['seo']['page_format_titles']['configurable_separator'] = array(
'#type' => 'textfield',
'#title' => t('Title separator'),
'#description' => t('Customize the separator character used in the page title'),
'#size' => 60,
'#default_value' => $settings['configurable_separator'],
);
// Metadata
$form['tnt_container']['seo']['meta'] = array(
'#type' => 'fieldset',
'#title' => t('Meta tags'),
'#description' => t('Meta tags aren\'t used much by search engines anymore, but the meta description is important -- this is what will be shown as the description of your link in search engine results. NOTE: For more advanced meta tag functionality, check out the Meta Tags (aka. Node Words) module. These theme settings do not work in conjunction with this module and will not appear if you have it enabled.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
if (module_exists('nodewords') == FALSE) {
$form['tnt_container']['seo']['meta']['meta_keywords'] = array(
'#type' => 'textfield',
'#title' => t('Meta keywords'),
'#description' => t('Enter a comma-separated list of keywords'),
'#size' => 60,
'#default_value' => $settings['meta_keywords'],
);
$form['tnt_container']['seo']['meta']['meta_description'] = array(
'#type' => 'textarea',
'#title' => t('Meta description'),
'#cols' => 60,
'#rows' => 6,
'#default_value' => $settings['meta_description'],
);
} else {
$form['tnt_container']['seo']['meta']['#description'] = 'NOTICE: You currently have the "nodewords" module installed and enabled, so the meta tag theme settings have been disabled to prevent conflicts. If you later wish to re-enable the meta tag theme settings, you must first disable the "nodewords" module.';
$form['tnt_container']['seo']['meta']['meta_keywords']['#disabled'] = 'disabled';
$form['tnt_container']['seo']['meta']['meta_description']['#disabled'] = 'disabled';
}
// Return theme settings form
return $form;
}
function m4music_add_imagecache_preset() {
$presets = imagecache_presets();
$addpreset = 1;
foreach ($presets as $k => $imgpreset) {
if ($imgpreset['presetname'] == 'm4music_banner_image') {
$addpreset = 0;
}
}
if ($addpreset) {
//install ImageCache presets
$imagecache_presets = array(array('presetname' => 'm4music_banner_image',));
$imagecache_actions = array('m4music_banner_image' => array('action' => 'imagecache_scale','data' => array('width' => 960,'height' => 70,'upscale' => 1,),'weight' => 0,),);
foreach ($imagecache_presets as $preset) {
$preset = imagecache_preset_save($preset);
$imagecache_actions[$preset['presetname']]['presetid'] = $preset['presetid'];
imagecache_action_save($imagecache_actions[$preset['presetname']]);
drupal_set_message(t('ImageCache preset %id: %name and corresponding actions saved.', array('%id' => $preset['presetid'], '%name' => $preset['presetname'])));
}
}
}
?>