Skip to content

Instantly share code, notes, and snippets.

@DESIGNfromWITHIN
Last active December 13, 2015 23:12
Show Gist options
  • Save DESIGNfromWITHIN/68c905ce692d62b0047e to your computer and use it in GitHub Desktop.
Save DESIGNfromWITHIN/68c905ce692d62b0047e to your computer and use it in GitHub Desktop.
addContent.rersolver.php
<?php
$sources = array(
'data' => $modx->getOption('core_path') . 'components/cosmos/contentResources/',
);
$addContent = $modx->getOption('add_content', $options, false);
if ($addContent) {
$resources = include $sources['data'] . 'transport.resources.php';
foreach ($resources as $resource) {
$modx->log(xPDO::LOG_LEVEL_INFO,'Installing content');
$resource->save();
}
}
$setSiteName = $modx->getOption('change_sitename', $options, false);
if ($setSiteName) {
$siteName = $modx->getOption('sitename', $options);
$modx->log(xPDO::LOG_LEVEL_INFO,'Setting site name to: ' . $siteName);
$setting = $modx->getObject('modSystemSetting','site_name');
$setting->set('value', $siteName);
$setting->save();
}
$modx->addPackage('clientconfig', MODX_CORE_PATH . 'components/clientconfig/model/');
$baseSettings = $modx->newObject('cgGroup');
$baseSettings->fromArray(array(
'label' => 'Base settings',
'sortorder' => '1',
'description' => 'Needed base settings'
));
$baseSettings->save();
$knowledge_base_id = $modx->newObject('cgSetting');
$knowledge_base_id->fromArray(array(
'key' => 'cosmos.knowledge_base_id',
'label' => 'Knowledge base page ID',
'xtype' => 'number',
'description' => 'The ID number of your questions container.',
'is_required' => '1',
'sortorder' => '1',
'value' => '2',
'group' => $baseSettings->get("id")
));
$knowledge_base_id->save();
$news_id = $modx->newObject('cgSetting');
$news_id->fromArray(array(
'key' => 'cosmos.news_id',
'label' => 'News page ID',
'xtype' => 'number',
'description' => 'The ID number of your news container.',
'is_required' => '1',
'sortorder' => '2',
'value' => '30',
'group' => $baseSettings->get("id")
));
$news_id->save();
$search_results_id = $modx->newObject('cgSetting');
$search_results_id->fromArray(array(
'key' => 'cosmos.search_results_id',
'label' => 'Search results page ID',
'xtype' => 'number',
'description' => 'The ID number of the Search results page.',
'is_required' => '1',
'sortorder' => '3',
'value' => '35',
'group' => $baseSettings->get("id")
));
$search_results_id->save();
$news_number_of_items = $modx->newObject('cgSetting');
$news_number_of_items->fromArray(array(
'key' => 'cosmos.news_number_of_items',
'label' => 'Number of news items',
'xtype' => 'number',
'description' => 'The number of news items on the latest news area.',
'is_required' => '1',
'sortorder' => '4',
'value' => '1=4',
'group' => $baseSettings->get("id")
));
$news_number_of_items->save();
$faq_number_of_questions = $modx->newObject('cgSetting');
$faq_number_of_questions->fromArray(array(
'key' => 'cosmos.faq_number_of_questions',
'label' => 'Number of most popular questions',
'xtype' => 'number',
'description' => 'How many questions do you want to show in the Most asked questions block?',
'is_required' => '1',
'sortorder' => '1',
'value' => '5',
'group' => $baseSettings->get("id")
));
$faq_number_of_questions->save();
$footerSettings = $modx->newObject('cgGroup');
$footerSettings->fromArray(array(
'label' => 'Footer settings',
'sortorder' => '10',
'description' => 'Settings for the footer'
));
$footerSettings->save();
$footer_box_01_title = $modx->newObject('cgSetting');
$footer_box_01_title->fromArray(array(
'key' => 'cosmos.footer_box_01_title',
'label' => 'Footer box 1 title',
'xtype' => 'textfield',
'description' => 'The title above the first footer box.',
'is_required' => '0',
'sortorder' => '1',
'value' => 'Pages',
'group' => $footerSettings->get("id")
));
$footer_box_01_title->save();
$footer_box_02_title = $modx->newObject('cgSetting');
$footer_box_02_title->fromArray(array(
'key' => 'cosmos.footer_box_02_title',
'label' => 'Footer box 2 title',
'xtype' => 'textfield',
'description' => 'The title above the second footer box.',
'is_required' => '0',
'sortorder' => '2',
'value' => 'Find us online',
'group' => $footerSettings->get("id")
));
$footer_box_02_title->save();
$footer_box_03_title = $modx->newObject('cgSetting');
$footer_box_03_title->fromArray(array(
'key' => 'cosmos.footer_box_03_title',
'label' => 'Footer box 3 title',
'xtype' => 'textfield',
'description' => 'The title above the third footer box.',
'is_required' => '0',
'sortorder' => '3',
'value' => 'Contact',
'group' => $footerSettings->get("id")
));
$footer_box_03_title->save();
$footer_box_03_content = $modx->newObject('cgSetting');
$footer_box_03_content->fromArray(array(
'key' => 'cosmos.footer_box_03_content',
'label' => 'Footer box 3 content',
'xtype' => 'richtext',
'description' => 'The content of the third footer box.',
'is_required' => '0',
'sortorder' => '4',
'value' => 'Some Company <br>Our street 123 <br>1234 AB <br>Amsterdam, The Netherlands <br><a href="mailto:[email protected]">[email protected]</a>',
'group' => $footerSettings->get("id")
));
$footer_box_03_content->save();
$colorSettings = $modx->newObject('cgGroup');
$colorSettings->fromArray(array(
'label' => 'Colors',
'sortorder' => '2',
'description' => 'Edit the colors of your site'
));
$colorSettings->save();
$accent_color = $modx->newObject('cgSetting');
$accent_color->fromArray(array(
'key' => 'cosmos.accent_color',
'label' => 'Main accent color',
'xtype' => 'colorpickerfield',
'description' => '',
'is_required' => '1',
'sortorder' => '1',
'value' => '052756',
'group' => $colorSettings->get("id")
));
$accent_color->save();
$accent_font_hover_color = $modx->newObject('cgSetting');
$accent_font_hover_color->fromArray(array(
'key' => 'cosmos.accent_font_hover_color',
'label' => 'Main accent hover color',
'xtype' => 'colorpickerfield',
'description' => '',
'is_required' => '1',
'sortorder' => '2',
'value' => 'cdcdcd',
'group' => $colorSettings->get("id")
));
$accent_font_hover_color->save();
$accent_font_color = $modx->newObject('cgSetting');
$accent_font_color->fromArray(array(
'key' => 'cosmos.accent_font_color',
'label' => 'Main accent font color',
'xtype' => 'colorpickerfield',
'description' => '',
'is_required' => '1',
'sortorder' => '3',
'value' => 'ffffff',
'group' => $colorSettings->get("id")
));
$accent_font_color->save();
$body_color = $modx->newObject('cgSetting');
$body_color->fromArray(array(
'key' => 'cosmos.body_color',
'label' => 'Body background color',
'xtype' => 'colorpickerfield',
'description' => '',
'is_required' => '1',
'sortorder' => '4',
'value' => 'ffffff',
'group' => $colorSettings->get("id")
));
$body_color->save();
$font_color = $modx->newObject('cgSetting');
$font_color->fromArray(array(
'key' => 'cosmos.font_color',
'label' => 'Font color',
'xtype' => 'colorpickerfield',
'description' => '',
'is_required' => '1',
'sortorder' => '5',
'value' => '646464',
'group' => $colorSettings->get("id")
));
$font_color->save();
$socialSettings = $modx->newObject('cgGroup');
$socialSettings->fromArray(array(
'label' => 'Social',
'sortorder' => '2',
'description' => 'Settings for social links and profiles for your site'
));
$socialSettings->save();
$twitter_name = $modx->newObject('cgSetting');
$twitter_name->fromArray(array(
'key' => 'cosmos.twitter_name',
'label' => 'Twitter link name',
'xtype' => 'textfield',
'description' => 'The name of your Twitter links',
'is_required' => '0',
'sortorder' => '1',
'value' => 'Twitter',
'group' => $socialSettings->get("id")
));
$twitter_name->save();
$twitter_url = $modx->newObject('cgSetting');
$twitter_url->fromArray(array(
'key' => 'cosmos.twitter_url',
'label' => 'Twitter URL',
'xtype' => 'textfield',
'description' => 'Fill in you Twitter profile URL',
'is_required' => '0',
'sortorder' => '2',
'value' => 'https://twitter.com/themes_modx',
'group' => $socialSettings->get("id")
));
$twitter_url->save();
$facebook_name = $modx->newObject('cgSetting');
$facebook_name->fromArray(array(
'key' => 'cosmos.facebook_name',
'label' => 'Facebook link name',
'xtype' => 'textfield',
'description' => 'The name of your Facebook links',
'is_required' => '0',
'sortorder' => '3',
'value' => '',
'group' => $socialSettings->get("id")
));
$facebook_name->save();
$facebook_url = $modx->newObject('cgSetting');
$facebook_url->fromArray(array(
'key' => 'cosmos.facebook_url',
'label' => 'Facebook URL',
'xtype' => 'textfield',
'description' => 'Fill in you Facebook profile URL',
'is_required' => '0',
'sortorder' => '4',
'value' => '',
'group' => $socialSettings->get("id")
));
$facebook_url->save();
$linkedin_name = $modx->newObject('cgSetting');
$linkedin_name->fromArray(array(
'key' => 'cosmos.linkedin_name',
'label' => 'LinkedIn link name',
'xtype' => 'textfield',
'description' => 'The name of your LinkedIn links',
'is_required' => '0',
'sortorder' => '5',
'value' => '',
'group' => $socialSettings->get("id")
));
$linkedin_name->save();
$linkedin_url = $modx->newObject('cgSetting');
$linkedin_url->fromArray(array(
'key' => 'cosmos.linkedin_url',
'label' => 'LinkedIn URL',
'xtype' => 'textfield',
'description' => 'Fill in you LinkedIn profile URL',
'is_required' => '0',
'sortorder' => '6',
'value' => '',
'group' => $socialSettings->get("id")
));
$linkedin_url->save();
$analyticsSettings = $modx->newObject('cgGroup');
$analyticsSettings->fromArray(array(
'label' => 'Google Analytics',
'sortorder' => '20',
'description' => 'Settings for Google Analytics SEO'
));
$analyticsSettings->save();
$analytics_code = $modx->newObject('cgSetting');
$analytics_code->fromArray(array(
'key' => 'cosmos.analytics_code',
'label' => 'Analytics code',
'xtype' => 'textfield',
'description' => 'Fill in your tracking code (like: UA-10989210-17)',
'is_required' => '0',
'sortorder' => '1',
'value' => '',
'group' => $analyticsSettings->get("id")
));
$analytics_code->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment