-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathroomify.install
More file actions
981 lines (846 loc) · 29.3 KB
/
Copy pathroomify.install
File metadata and controls
981 lines (846 loc) · 29.3 KB
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
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
<?php
/**
* @file
* Installation code for Roomify
*/
/**
* Implements hook_install_tasks().
*/
function roomify_install_tasks(&$install_state) {
// Increase maximum function nesting level to prevent install errors.
$max_nesting_level = ini_get('xdebug.max_nesting_level');
if ($max_nesting_level > 0 && $max_nesting_level <= '200') {
ini_set('xdebug.max_nesting_level', 200);
}
// Remove any status messages that might have been set. They are unneeded.
drupal_get_messages('status', TRUE);
$tasks = array();
$current_task = variable_get('install_task', 'done');
$tasks['roomify_install_write_composer_manager_file'] = array(
'display' => FALSE,
'display_name' => 'Writing the composer manager file.',
'type' => 'batch'
);
$tasks['roomify_setup_product'] = array(
'display_name' => st('Install Chosen Roomify Product'),
'type' => 'batch',
// Show this task only after the roomify steps have been reached.
'display' => strpos($current_task, 'roomify_') !== FALSE,
);
return $tasks;
}
/**
* Implements hook_install_tasks_alter().
*/
function roomify_install_tasks_alter(&$tasks, $install_state) {
$tasks['install_finished']['function'] = 'roomify_install_finished';
$tasks['install_select_profile']['display'] = FALSE;
$tasks['install_select_locale']['display'] = FALSE;
$tasks['install_select_locale']['run'] = INSTALL_TASK_SKIP;
$tasks['install_profile_modules']['display_name'] = st('Install Roomify');
// The "Welcome" screen needs to come after the first two steps
// (profile and language selection), despite the fact that they are disabled.
$new_task['roomify_install_welcome'] = array(
'display' => TRUE,
'display_name' => st('Welcome'),
'type' => 'form',
'run' => isset($install_state['parameters']['welcome']) ? INSTALL_TASK_SKIP : INSTALL_TASK_RUN_IF_REACHED,
);
$old_tasks = $tasks;
$tasks = array_slice($old_tasks, 0, 2) + $new_task + array_slice($old_tasks, 2);
// Set the installation theme.
_roomify_set_theme('roomify_adminimal_theme');
}
/**
* Force-set a theme at any point during the execution of the request.
*
* Drupal doesn't give us the option to set the theme during the installation
* process and forces enable the maintenance theme too early in the request
* for us to modify it in a clean way.
*/
function _roomify_set_theme($target_theme) {
if ($GLOBALS['theme'] != $target_theme) {
unset($GLOBALS['theme']);
drupal_static_reset();
$GLOBALS['conf']['maintenance_theme'] = $target_theme;
_drupal_maintenance_theme();
}
}
/**
* Task callback: shows the welcome screen.
*/
function roomify_install_welcome($form, &$form_state, &$install_state) {
drupal_set_title(st('Welcome to Roomify'));
$message = '<h2>' . st('Thank you for choosing the Roomify distribution, the best way to launch and manage a vacation rental, hotel or multi-property site.') . '</h2>';
$form = array();
$form['welcome_message'] = array(
'#markup' => $message,
);
$form['roomify_product'] = array(
'#title' => st('Please select what type of Roomify Installation you would like'),
'#title_display' => 'invisible',
'#type' => 'radios',
'#default_value' => 'accommodations',
'#options' => array(
'roomify' => st('Basic Roomify: A basic version of Roomify tools for development and evaluation'),
'accommodations' => st('Accommodations: I would like to manage a site for vacation rentals, B&Bs, and/or Hotels.'),
),
);
$form['dev_style'] = array(
'#title' => st('Pick whether you would like devel modules on or off'),
'#type' => 'radios',
'#default_value' => 'off',
'#options' => array(
'on' => st('Dev modules on'),
'off' => st('Dev modules off'),
),
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => st("Let's Get Started!"),
'#weight' => 10,
);
return $form;
}
/**
* Submit function for welcome screen form
*/
function roomify_install_welcome_submit($form, &$form_state) {
global $install_state;
$install_state['parameters']['welcome'] = 'done';
$install_state['parameters']['locale'] = 'en';
$install_state['parameters']['roomify_product'] = $form_state['values']['roomify_product'];
$install_state['parameters']['dev_style'] = $form_state['values']['dev_style'];
}
/**
* Task callback: Enables Composer Manager and scan all the composer.json files.
*/
function roomify_install_write_composer_manager_file(&$install_state) {
module_enable(array('composer_manager'));
// Write the composer.json file.
composer_manager_write_file();
}
function roomify_setup_product(&$install_state) {
global $install_state;
$roomify_product = $install_state['parameters']['roomify_product'];
$modules = array();
// Common modules
$modules = array(
'roomify_system',
'roomify_landing_page',
'roomify_blog',
'roomify_mapping',
'roomify_things_to_do',
'roomify_editor',
);
// Modules that only get installed if a dev version of the
// distro was requested.
$devel_modules = array();
if ($install_state['parameters']['dev_style'] == 'on') {
$devel_modules = array(
'views_ui',
'rules_admin',
'slick_ui',
'devel',
'diff',
'module_filter',
);
}
switch ($roomify_product) {
case 'roomify':
drupal_set_title(st('We are configuring standard Roomify for you.'));
break;
case 'accommodations':
drupal_set_title(st('We are configuring accommodations management.'));
$accommodations_modules = array (
'roomify_listing',
'roomify_property',
'roomify_rate',
'roomify_casa',
'roomify_locanda',
'roomify_casa_event_ui',
'roomify_locanda_event_ui',
'roomify_casa_pet',
'roomify_area',
'roomify_accommodation_example_content',
'roomify_channel_connector',
'roomify_channel_ical',
);
$modules = array_merge($modules, $accommodations_modules);
break;
}
// Remember the selected roomify product.
variable_set('roomify_installed_product', $roomify_product);
// Add the dev modules to the mix
$modules = array_merge($modules, $devel_modules);
$modules = roomify_identify_module_dependencies($modules);
$operations = array();
// Enable the selected modules.
$files = system_rebuild_module_data();
foreach ($modules as $module => $weight) {
$operations[] = array('_roomify_enable_module', array($module, $files[$module]->info['name']));
}
// Enable and set as default the correct theme.
$theme = 'roomify_travel';
$operations[] = array('_roomify_enable_theme', array($theme));
$operations[] = array('_roomify_flush_caches', array(t('Flushed caches.')));
$batch = array(
'title' => t('Installing additional functionality'),
'operations' => $operations,
'file' => drupal_get_path('profile', 'roomify') . '/roomify_common.install_callbacks.inc',
);
return $batch;
}
/**
* Identifies module dependencies so as to install all during
* batch install step for efficiency.
* @param $modules
*/
function roomify_identify_module_dependencies($modules){
// Resolve the dependencies now, so that module_enable() doesn't need
// to do it later for each individual module (which kills performance).
$files = system_rebuild_module_data();
$modules_sorted = array();
foreach ($modules as $module) {
if ($files[$module]->requires) {
// Create a list of dependencies that haven't been installed yet.
$dependencies = array_keys($files[$module]->requires);
$dependencies = array_filter($dependencies, '_roomify_filter_dependencies');
// Add them to the module list.
$modules = array_merge($modules, $dependencies);
}
}
$modules = array_unique($modules);
foreach ($modules as $module) {
$modules_sorted[$module] = $files[$module]->sort;
}
arsort($modules_sorted);
return $modules_sorted;
}
/**
* array_filter() callback used to filter out already installed dependencies.
*/
function _roomify_filter_dependencies($dependency) {
return !module_exists($dependency);
}
/**
* Task: Install finished
*/
function roomify_install_finished(&$install_state) {
drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_distribution_name())), PASS_THROUGH);
$messages = drupal_set_message();
$translatable_entities = variable_get('entity_translation_entity_types', array());
$translatable_entities['node'] = 'node';
$translatable_entities['bat_type'] = 'bat_type';
$translatable_entities['roomify_property'] = 'roomify_property';
$translatable_entities['entityform'] = 'entityform';
$translatable_entities['profile2'] = 'profile2';
$translatable_entities['paragraphs_item'] = 'paragraphs_item';
// Enable translation for properties and types.
variable_set('entity_translation_entity_types', $translatable_entities);
// Clear the entity info cache for the new entity translation settings.
entity_info_cache_clear();
// Remember the profile which was used.
variable_set('install_profile', drupal_get_profile());
variable_set('install_task', 'done');
// Enable Jquery Migrate.
variable_set('jquery_update_jquery_migrate_enable', 1);
// Enable the page manager node view.
variable_set('page_manager_node_view_disabled', 0);
// Do not include site style sheets in emails.
variable_set('mimemail_sitestyle', 0);
variable_set('configurable_timezones', 0);
variable_set('bat_fullcalendar_scheduler_key', 'commercial');
variable_set('bat_fullcalendar_scheduler_commercial_key', '0297822786-fcs-1455697240');
variable_set('better_messages', roomify_get_better_message_configuration());
variable_set('mimemail_format', 'rich_text');
variable_set('logintoboggan_login_with_email', '1');
// AddToAny Variables
variable_set('addtoany_buttons_size', '25');
variable_set('addtoany_additional_html', '<a class="a2a_button_facebook"></a>
<a class="a2a_button_twitter"></a>
<a class="a2a_button_pinterest"></a>
<a class="a2a_button_google_plus"></a>');
variable_set('addtoany_additional_html_placement', 'before');
variable_set('addtoany_image', 'a2a_svg_32');
// Image Toolkit
variable_set('image_toolkit', 'imageapi_optimize');
variable_set('imageapi_optimize_toolkit', 'gd');
variable_set('image_jpeg_quality', '100');
variable_set('imageapi_optimize_service', 'resmushit');
// Select2 Settings.
variable_set('select2_update_settings_by_ajax', 1);
variable_set('select2_use_for_ac_elements', 0);
variable_set('select2_use_for_all_select_elements', 1);
variable_set('select2_use_for_all_select_elements_for_admin_pages', 1);
variable_set('select2_update_settings_by_ajax', 1);
variable_set('select2_min_options_count_for_search', 4);
// Yoast Settings.
variable_set('yoast_seo_vertical_tab', 1);
$path = libraries_get_path('select2');
variable_set('select2_plugin_path', $path);
variable_set('popup_message_visibility_pages', 'admin/*');
variable_set('media_wysiwyg_external_link', TRUE);
// Enable "Media Colorbox" display.
$media_colorbox_display = file_display_new('image', 'colorbox', 'file_field_media_colorbox');
$media_colorbox_display->status = 1;
file_display_save($media_colorbox_display);
$menu = menu_load('main-menu');
module_load_include('module', 'i18n');
$menu['language'] = 'en';
$menu['i18n_mode'] = I18N_MODE_MULTIPLE;
menu_save($menu);
// Create Common Menu Links.
roomify_system_create_update_menu_link('Home', '<front>', 'main-menu', -20);
roomify_system_create_update_menu_link('Areas', 'areas', 'main-menu', -5);
roomify_system_create_update_menu_link('Properties', 'availability-search', 'main-menu', -10);
roomify_system_create_update_menu_link('Things to do', 'things-to-do', 'main-menu', -3);
roomify_system_create_update_menu_link('Location', 'location', 'main-menu', -1);
roomify_system_create_update_menu_link('Blog', 'blog', 'main-menu', -2);
drupal_flush_all_caches();
// Create the sidebar menu.
roomify_dashboard_create_dashboard_menu();
menu_rebuild();
// Include nodes and location terms to the xml_sitemap.
$node_types = array('blog', 'landing_page', 'offer', 'location', 'page', 'activity', 'homepage', 'properties_list');
foreach ($node_types as $type) {
$settings = variable_get('xmlsitemap_settings_node_' . $type, array());
$settings['status'] = '1';
$settings['priority'] = '0.5';
variable_set('xmlsitemap_settings_node_' . $type, $settings);
}
$settings = variable_get('xmlsitemap_settings_taxonomy_term_location', array());
$settings['status'] = '1';
$settings['priority'] = '0.5';
variable_set('xmlsitemap_settings_taxonomy_term_location', $settings);
// Save 'administrator' role to force creation of machine name.
$admin_role = user_role_load_by_name('administrator');
user_role_save($admin_role);
variable_set('user_register', 0);
$tune = variable_get('google_recaptcha', array());
$tune['protected_forms'] = array();
variable_set('google_recaptcha', $tune);
$settings = array(
'status' => '1',
'priority' => '0.5',
);
variable_set('xmlsitemap_settings_roomify_property_casa_property', $settings);
variable_set('xmlsitemap_settings_roomify_property_locanda_property', $settings);
if (isset($messages['error'])) {
$output = '<p>' . (isset($messages['error']) ? st('Review the messages above before visiting <a href="@url">your new site</a>.', array('@url' => url(''))) : st('<a href="@url">Visit your new site</a>.', array('@url' => url('')))) . '</p>';
return $output;
}
else {
// Since any module can add a drupal_set_message, this can bug the user
// when we redirect him to the front page. For a better user experience,
// remove all the message that are only "notifications" message.
drupal_get_messages('status', TRUE);
drupal_get_messages('completed', TRUE);
// Migrate adds its messages under the wrong type, see #1659150.
drupal_get_messages('ok', TRUE);
// If we don't install drupal using Drush, redirect the user to the front
// page.
if (!drupal_is_cli()) {
if (module_exists('overlay')) {
// Special case when no clean urls.
$fragment = empty($GLOBALS['conf']['clean_url']) ? urlencode('?q=admin/help/getting-started') : 'admin/help/getting-started';
drupal_goto('', array('fragment' => 'overlay=' . $fragment));
}
else {
drupal_goto('admin/help/getting-started');
}
}
}
}
/**
* Implements hook_install().
*/
function roomify_install() {
_roomify_install_set_themes();
_roomify_install_set_blocks();
_roomify_install_create_text_filters_permissions();
// Update the menu router information.
menu_rebuild();
}
function _roomify_install_set_blocks() {
// Enable some agency blocks.
$default_theme = 'roomify_travel';
$admin_theme = 'roomify_adminimal_theme';
// Disable all themes.
db_update('system')
->fields(array('status' => 0))
->condition('type', 'theme')
->execute();
// Enable default theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', $default_theme)
->execute();
// Enable admin theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', $admin_theme)
->execute();
// Enable bootstrap theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'bootstrap')
->execute();
// Enable adminimal theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'adminimal')
->execute();
variable_set('theme_default', $default_theme);
variable_set('admin_theme', $admin_theme);
// Activate admin theme when editing nodes.
variable_set('node_admin_theme', '1');
// Block setup.
$blocks = array(
array(
'module' => 'system',
'delta' => 'main',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $default_theme,
'status' => 1,
'weight' => -10,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'main',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'panels_mini',
'delta' => 'sidebar',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'sidebar_toggle_menu',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'panels_mini',
'delta' => 'footer',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'footer',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'panels_mini',
'delta' => 'sidebar',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'sidebar_toggle_menu',
'pages' => '',
'cache' => -1,
)
);
// Drop system / user blocks to ensure correct building
db_delete('block')->condition('module', 'system')->execute();
db_delete('block')->condition('module', 'user')->execute();
// Add in our custom blocks. (defined above)
$query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
foreach ($blocks as $block) {
$query->values($block);
}
$query->execute();
}
function _roomify_install_set_themes() {
$default_theme = 'roomify_travel';
$admin_theme = 'roomify_adminimal_theme';
// Disable all themes.
db_update('system')
->fields(array('status' => 0))
->condition('type', 'theme')
->execute();
// Enable default theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', $default_theme)
->execute();
// Enable admin theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', $admin_theme)
->execute();
// Enable bootstrap theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'bootstrap')
->execute();
// Enable adminimal theme.
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'adminimal')
->execute();
variable_set('theme_default', $default_theme);
variable_set('admin_theme', $admin_theme);
// Some settings for the administration theme.
$admin_theme_settings = variable_get('theme_' . $admin_theme . '_settings', array());
$admin_theme_settings['adminimal_theme_skin'] = 'material';
variable_set('theme_' . $admin_theme . '_settings', $admin_theme_settings);
// Some settings for the default theme.
$default_theme_settings = variable_get('theme_' . $default_theme . '_settings', array());
$default_theme_settings['toggle_logo'] = 0;
$default_theme_settings['toggle_name'] = 1;
$default_theme_settings['toggle_slogan'] = 0;
$default_theme_settings['toggle_secondary_menu'] = 0;
$default_theme_settings['bootstrap_navbar_position'] = '';
$default_theme_settings['bootstrap_fluid_container'] = 1;
variable_set('theme_' . $default_theme . '_settings', $default_theme_settings);
// Set this configuration for the bootstrap theme.
variable_set('theme_roomify_bootstrap_settings', $default_theme_settings);
// Set this configuration for the bootstrap wide theme.
variable_set('theme_roomify_bootstrap_wide_settings', $default_theme_settings);
// Activate admin theme when editing nodes.
variable_set('node_admin_theme', '1');
}
function _roomify_install_create_text_filters_permissions() {
// Add text formats.
$filtered_html_format = array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
'filters' => array(
// URL filter.
'filter_url' => array(
'weight' => 0,
'status' => 1,
),
// HTML filter.
'filter_html' => array(
'weight' => 1,
'status' => 1,
),
// Line break filter.
'filter_autop' => array(
'weight' => 2,
'status' => 1,
),
// HTML corrector filter.
'filter_htmlcorrector' => array(
'weight' => 10,
'status' => 1,
),
),
);
$filtered_html_format = (object) $filtered_html_format;
filter_format_save($filtered_html_format);
$full_html_format = array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
'filters' => array(
// URL filter.
'filter_url' => array(
'weight' => 0,
'status' => 1,
),
// Line break filter.
'filter_autop' => array(
'weight' => 1,
'status' => 1,
),
// HTML corrector filter.
'filter_htmlcorrector' => array(
'weight' => 10,
'status' => 1,
),
),
);
$full_html_format = (object) $full_html_format;
filter_format_save($full_html_format);
// Enable default permissions for system roles.
$filtered_html_permission = filter_permission_name($filtered_html_format);
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', 'access comments', $filtered_html_permission));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', 'access comments', 'post comments', 'skip comment approval', $filtered_html_permission));
// Create a default role for site administrators, with all available permissions assigned.
$admin_role = new stdClass();
$admin_role->name = 'administrator';
$admin_role->weight = 2;
user_role_save($admin_role);
user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission')));
// Set this as the administrator role.
variable_set('user_admin_role', $admin_role->rid);
// Assign user 1 the "administrator" role.
db_insert('users_roles')
->fields(array('uid' => 1, 'rid' => $admin_role->rid))
->execute();
}
function _roomify_install_create_standard_node_types() {
// Insert default pre-defined node types into the database. For a complete
// list of available node type attributes, refer to the node type API
// documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
$types = array(
array(
'type' => 'page',
'name' => st('Basic page'),
'base' => 'node_content',
'description' => st("Use <em>basic pages</em> for your static content, such as an 'About us' page."),
'custom' => 1,
'modified' => 1,
'locked' => 0,
),
array(
'type' => 'article',
'name' => st('Article'),
'base' => 'node_content',
'description' => st('Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.'),
'custom' => 1,
'modified' => 1,
'locked' => 0,
),
);
foreach ($types as $type) {
$type = node_type_set_defaults($type);
node_type_save($type);
node_add_body_field($type);
}
// Insert default pre-defined RDF mapping into the database.
$rdf_mappings = array(
array(
'type' => 'node',
'bundle' => 'page',
'mapping' => array(
'rdftype' => array('foaf:Document'),
),
),
array(
'type' => 'node',
'bundle' => 'article',
'mapping' => array(
'field_image' => array(
'predicates' => array('og:image', 'rdfs:seeAlso'),
'type' => 'rel',
),
'field_tags' => array(
'predicates' => array('dc:subject'),
'type' => 'rel',
),
),
),
);
foreach ($rdf_mappings as $rdf_mapping) {
rdf_mapping_save($rdf_mapping);
}
// Default "Basic page" to not be promoted and have comments disabled.
variable_set('node_options_page', array('status'));
variable_set('comment_page', COMMENT_NODE_HIDDEN);
// Don't display date and author information for "Basic page" nodes by default.
variable_set('node_submitted_page', FALSE);
// Enable user picture support and set the default to a square thumbnail option.
variable_set('user_pictures', '1');
variable_set('user_picture_dimensions', '1024x1024');
variable_set('user_picture_file_size', '800');
variable_set('user_picture_style', 'thumbnail');
// Allow visitor account creation with administrative approval.
variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
// Set the appropriate error display level
variable_set('error_level', 0);
// Create a default vocabulary named "Tags", enabled for the 'article' content type.
$description = st('Use tags to group articles on similar topics into categories.');
$vocabulary = (object) array(
'name' => st('Tags'),
'description' => $description,
'machine_name' => 'tags',
);
taxonomy_vocabulary_save($vocabulary);
$field = array(
'field_name' => 'field_' . $vocabulary->machine_name,
'type' => 'taxonomy_term_reference',
// Set cardinality to unlimited for tagging.
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'settings' => array(
'allowed_values' => array(
array(
'vocabulary' => $vocabulary->machine_name,
'parent' => 0,
),
),
),
);
field_create_field($field);
$help = st('Enter a comma-separated list of words to describe your content.');
$instance = array(
'field_name' => 'field_' . $vocabulary->machine_name,
'entity_type' => 'node',
'label' => 'Tags',
'bundle' => 'article',
'description' => $help,
'widget' => array(
'type' => 'taxonomy_autocomplete',
'weight' => -4,
),
'display' => array(
'default' => array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
),
'teaser' => array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
),
),
);
field_create_instance($instance);
// Create an image field named "Image", enabled for the 'article' content type.
// Many of the following values will be defaulted, they're included here as an illustrative examples.
// See http://api.drupal.org/api/function/field_create_field/7
$field = array(
'field_name' => 'field_image',
'type' => 'image',
'cardinality' => 1,
'locked' => FALSE,
'indexes' => array('fid' => array('fid')),
'settings' => array(
'uri_scheme' => 'public',
'default_image' => FALSE,
),
'storage' => array(
'type' => 'field_sql_storage',
'settings' => array(),
),
);
field_create_field($field);
// Many of the following values will be defaulted, they're included here as an illustrative examples.
// See http://api.drupal.org/api/function/field_create_instance/7
$instance = array(
'field_name' => 'field_image',
'entity_type' => 'node',
'label' => 'Image',
'bundle' => 'article',
'description' => st('Upload an image to go with this article.'),
'required' => FALSE,
'settings' => array(
'file_directory' => 'field/image',
'file_extensions' => 'png gif jpg jpeg',
'max_filesize' => '',
'max_resolution' => '',
'min_resolution' => '',
'alt_field' => TRUE,
'title_field' => '',
),
'widget' => array(
'type' => 'image_image',
'settings' => array(
'progress_indicator' => 'throbber',
'preview_image_style' => 'thumbnail',
),
'weight' => -1,
),
'display' => array(
'default' => array(
'label' => 'hidden',
'type' => 'image',
'settings' => array('image_style' => 'large', 'image_link' => ''),
'weight' => -1,
),
'teaser' => array(
'label' => 'hidden',
'type' => 'image',
'settings' => array('image_style' => 'medium', 'image_link' => 'content'),
'weight' => -1,
),
),
);
field_create_instance($instance);
}
// Config array for better messages.
function roomify_get_better_message_configuration() {
$better_messages_settings = array(
'position' => 'center',
'vertical' => '0',
'horizontal' => '10',
'fixed' => '1',
'width' => '400px',
'autoclose' => '0',
'opendelay' => '0.3',
'disable_autoclose' => '0',
'show_countdown' => '1',
'hover_autoclose' => '1',
'popin' => array(
'effect' => 'fadeIn',
'duration' => 'slow',
),
'popout' => array(
'effect' => 'fadeIn',
'duration' => 'slow',
),
'jquery_ui' => array(
'draggable' => '0',
'resizable' => '0',
),
'extra' => array(
'pages' => 'admin/*
devel/php
user/reset',
'visibility' => '0',
'admin' => '0',
),
);
return $better_messages_settings;
}
/**
* Set mimemail to not use the sitestyle CSS.
*/
function roomify_update_7001() {
// Do not include site style sheets in emails
variable_set('mimemail_sitestyle', 0);
}
/**
* Disable "Users may set their own time zone".
*/
function roomify_update_7002() {
variable_set('configurable_timezones', 0);
}
/**
* Set FullCalendar license key.
*/
function roomify_update_7003() {
variable_set('bat_fullcalendar_scheduler_key', 'commercial');
variable_set('bat_fullcalendar_scheduler_commercial_key', '0297822786-fcs-1455697240');
}