diff --git a/administrator/language/en-GB/plg_sampledata_blog.ini b/administrator/language/en-GB/plg_sampledata_blog.ini index ebaba7f92b8d9..8cd2f20f8a49d 100644 --- a/administrator/language/en-GB/plg_sampledata_blog.ini +++ b/administrator/language/en-GB/plg_sampledata_blog.ini @@ -24,10 +24,27 @@ PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_4_TITLE="Your Modules" PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_5_FULLTEXT="" PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_5_INTROTEXT="

Templates control the look and feel of your website.

This blog is installed with the Protostar template.

You can edit the options by selecting the Working on Your Site, Template Settings link in the top menu (visible when you login).

For example you can change the site background color, highlights color, site title, site description and title font used.

More options are available in the site administrator. You may also install a new template using the extension manager.

" PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_5_TITLE="Your Template" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_6_FULLTEXT="" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_6_INTROTEXT="

Text Article1
This will be a nice documentation on multi column Layouts in J4.

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est

" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_6_TITLE="Lorem ipsum1" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_7_FULLTEXT="" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_7_INTROTEXT="

Text Article2
Cupcake ipsum dolor. Sit amet cotton candy ice cream sesame snaps cake marshmallow powder. Ice cream chocolate cake marshmallow halvah bonbon. Dragée carrot cake danish candy muffin brownie. Candy sugar plum ice cream chupa chups macaroon tiramisu soufflé oat cake. Topping cheesecake lollipop gummi bears icing sweet roll donut liquorice. Pie jelly-o candy donut oat cake cotton candy.

" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_7_TITLE="Lorem ipsum2" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_8_FULLTEXT="" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_8_INTROTEXT="

Text Article3
urnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado daikon napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach carrot soko. Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin onion chickpea gram corn pea. Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi beetroot carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.

" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_8_TITLE="Lorem ipsum3" PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_CATEGORY_0_TITLE="Blog" PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_CATEGORY_1_TITLE="Help" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_CATEGORY_2_TITLE="Template" PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_0_TITLE="Blog" PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_10_TITLE="Template Settings" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_11_TITLE="Template" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_12_TITLE="Category List" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_14_TITLE="Article" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_15_TITLE="Archive" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_16_TITLE="Articles" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_17_TITLE="Lorem" +PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_18_TITLE="Ipsum" PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_1_TITLE="About" PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_2_TITLE="Author Login" PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_3_TITLE="Create a Post" diff --git a/plugins/sampledata/blog/blog.php b/plugins/sampledata/blog/blog.php index 46684dcf14d79..0cce810aa9afe 100644 --- a/plugins/sampledata/blog/blog.php +++ b/plugins/sampledata/blog/blog.php @@ -214,31 +214,99 @@ public function onAjaxSampledataApplyStep1() // Get ID from category we just added $catIds[] = $categoryModel->getItem()->id; + // Create "template" category. + $categoryTitle = Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_CATEGORY_2_TITLE'); + $alias = ApplicationHelper::stringURLSafe($categoryTitle); + + // Set unicodeslugs if alias is empty + if (trim(str_replace('-', '', $alias) == '')) + { + $unicode = $this->app->set('unicodeslugs', 1); + $alias = ApplicationHelper::stringURLSafe($categoryTitle); + $this->app->set('unicodeslugs', $unicode); + } + + $category = array( + 'title' => $categoryTitle . $langSuffix, + 'parent_id' => 1, + 'id' => 0, + 'published' => 1, + 'access' => $access, + 'created_user_id' => $user->id, + 'extension' => 'com_content', + 'level' => 1, + 'alias' => $alias . $langSuffix, + 'associations' => array(), + 'description' => '', + 'language' => $language, + 'params' => '{}', + ); + + try + { + if (!$categoryModel->save($category)) + { + throw new Exception($categoryModel->getError()); + } + } + catch (Exception $e) + { + $response = array(); + $response['success'] = false; + $response['message'] = Text::sprintf('PLG_SAMPLEDATA_BLOG_STEP_FAILED', 1, $e->getMessage()); + + return $response; + } + + // Get ID from category we just added + $catIds[] = $categoryModel->getItem()->id; + // Create Articles. $articles = array( array( 'catid' => $catIds[1], + 'featured' => 0, 'ordering' => 2, ), array( 'catid' => $catIds[1], 'ordering' => 1, + 'featured' => 0, 'access' => 3, ), array( 'catid' => $catIds[0], + 'featured' => 1, 'ordering' => 2, ), array( 'catid' => $catIds[0], + 'featured' => 1, 'ordering' => 1, ), array( 'catid' => $catIds[0], + 'featured' => 1, 'ordering' => 0, ), array( 'catid' => $catIds[0], + 'featured' => 0, + 'ordering' => 0, + ), + array( + 'catid' => $catIds[2], + 'featured' => 0, + 'ordering' => 0, + ), + array( + 'catid' => $catIds[2], + 'featured' => 0, + 'ordering' => 0, + ), + array( + 'catid' => $catIds[2], + 'featured' => 0, 'ordering' => 0, ), ); @@ -274,7 +342,6 @@ public function onAjaxSampledataApplyStep1() $article['language'] = $language; $article['associations'] = array(); $article['state'] = 1; - $article['featured'] = 0; $article['images'] = ''; $article['metakey'] = ''; $article['metadesc'] = ''; @@ -391,32 +458,21 @@ public function onAjaxSampledataApplyStep2() // Insert menuitems level 1. $menuItems = array( + // Blog array( 'menutype' => $menuTypes[0], 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_0_TITLE'), - 'link' => 'index.php?option=com_content&view=category&layout=blog&id=' . $catids[0], - 'component_id' => ExtensionHelper::getExtensionRecord('com_content', 'component')->extension_id, + 'type' => 'heading', + 'link' => '', + 'component_id' => '', 'params' => array( - 'layout_type' => 'blog', - 'show_category_title' => 0, - 'num_leading_articles' => 4, - 'num_intro_articles' => 0, - 'num_links' => 2, - 'orderby_sec' => 'rdate', - 'order_date' => 'published', - 'show_pagination' => 2, - 'show_pagination_results' => 1, - 'show_category' => 0, - 'info_bloc_position' => 0, - 'show_publish_date' => 0, - 'show_hits' => 0, - 'show_feed_link' => 1, - 'menu_text' => 1, - 'show_page_heading' => 0, - 'secure' => 0, + 'menu_text' => 1, + 'show_page_heading' => 1, + 'secure' => 0, ), ), array( + // About 'menutype' => $menuTypes[0], 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_1_TITLE'), 'link' => 'index.php?option=com_content&view=article&id=' . $articleIds[0], @@ -435,6 +491,7 @@ public function onAjaxSampledataApplyStep2() ), ), array( + // Author Login 'menutype' => $menuTypes[0], 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_2_TITLE'), 'link' => 'index.php?option=com_users&view=login', @@ -447,6 +504,34 @@ public function onAjaxSampledataApplyStep2() 'secure' => 0, ), ), + // Blog with 3 columns + array( + 'menutype' => $menuTypes[0], + 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_11_TITLE'), + 'link' => 'index.php?option=com_content&view=category&layout=blog&id=' . $catids[2], + 'component_id' => ExtensionHelper::getExtensionRecord('com_content', 'component')->extension_id, + 'params' => array( + 'layout_type' => 'blog', + 'blog_class_leading' => '', + 'blog_class' => 'boxed columns-2', + 'show_category_title' => 0, + 'num_leading_articles' => 1, + 'num_intro_articles' => 2, + 'num_links' => 0, + 'orderby_sec' => 'rdate', + 'order_date' => 'published', + 'show_pagination' => 2, + 'show_pagination_results' => 1, + 'show_category' => 0, + 'info_bloc_position' => 0, + 'show_publish_date' => 0, + 'show_hits' => 0, + 'show_feed_link' => 1, + 'menu_text' => 1, + 'show_page_heading' => 0, + 'secure' => 0, + ), + ), array( 'menutype' => $menuTypes[1], 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_3_TITLE'), @@ -524,8 +609,9 @@ public function onAjaxSampledataApplyStep2() return $response; } - // Insert another level 1. + // Insert level 1. $menuItems = array( + // Author Login array( 'menutype' => $menuTypes[2], 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_8_TITLE'), @@ -582,11 +668,106 @@ public function onAjaxSampledataApplyStep2() 'secure' => 0, ), ), + array( + // Category List + 'menutype' => $menuTypes[0], + 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_12_TITLE'), + 'link' => 'index.php?option=com_content&view=category&layout=list&id=8', + 'parent_id' => $menuIdsLevel1[0], + 'component_id' => ExtensionHelper::getExtensionRecord('com_content', 'component')->extension_id, + 'params' => array( + 'page_subheading' => 'Subheading of List', + 'menu_text' => 1, + 'show_page_heading' => 1, + 'secure' => 0, + ), + ), + array( + // Single article + 'menutype' => $menuTypes[0], + 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_14_TITLE'), + 'link' => 'index.php?option=com_content&view=article&id=3', + 'parent_id' => $menuIdsLevel1[0], + 'component_id' => ExtensionHelper::getExtensionRecord('com_content', 'component')->extension_id, + 'params' => array( + 'menu_text' => 1, + 'show_page_heading' => 1, + 'secure' => 0, + ), + ), + array( + // Category List + 'menutype' => $menuTypes[0], + 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_15_TITLE'), + 'link' => 'index.php?option=com_content&view=featured', + 'parent_id' => $menuIdsLevel1[0], + 'component_id' => ExtensionHelper::getExtensionRecord('com_content', 'component')->extension_id, + 'params' => array( + 'menu_text' => 1, + 'show_page_heading' => 1, + 'secure' => 0, + ), + ), + array( + // Articles (menun header) + 'menutype' => $menuTypes[0], + 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_16_TITLE'), + 'type' => 'heading', + 'link' => '', + 'parent_id' => $menuIdsLevel1[0], + 'component_id' => '', + 'params' => array( + 'menu_text' => 1, + 'show_page_heading' => 1, + 'secure' => 0, + ), + ), + ); + + try + { + $menuIdsLevel2 = $this->addMenuItems($menuItems, 2); + } + catch (Exception $e) + { + $response = array(); + $response['success'] = false; + $response['message'] = Text::sprintf('PLG_SAMPLEDATA_BLOG_STEP_FAILED', 2, $e->getMessage()); + + return $response; + } + + // Add a third level of menuItems + $menuItems = array( + array( + // Article1 + 'menutype' => $menuTypes[0], + 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_17_TITLE'), + 'link' => 'index.php?option=com_content&view=article&id=&id=' . (int) $articleIds[6], + 'parent_id' => $menuIdsLevel2[5], + 'component_id' => ExtensionHelper::getExtensionRecord('com_content', 'component')->extension_id, + 'params' => array( + 'menu_show' => 1, + 'secure' => 0, + ), + ), + array( + // Article2 + 'menutype' => $menuTypes[0], + 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_18_TITLE'), + 'link' => 'index.php?option=com_content&view=article&id=' . (int) $articleIds[7], + 'parent_id' => $menuIdsLevel2[5], + 'component_id' => ExtensionHelper::getExtensionRecord('com_content', 'component')->extension_id, + 'params' => array( + 'menu_show' => 1, + 'secure' => 0, + ), + ), ); try { - $this->addMenuItems($menuItems, 2); + $this->addMenuItems($menuItems, 3); } catch (Exception $e) { @@ -641,29 +822,31 @@ public function onAjaxSampledataApplyStep3() $catids = $this->app->getUserState('sampledata.blog.articles.catids'); $modules = array( + // The main menu Blog array( 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MODULES_MODULE_0_TITLE'), 'ordering' => 1, - 'position' => 'top-a', + 'position' => 'menu', 'module' => 'mod_menu', 'showtitle' => 0, 'params' => array( 'menutype' => $menuTypes[0], + 'layout' => 'cassiopeia:metismenu', 'startLevel' => 1, - 'endLevel' => 0, - 'showAllChildren' => 0, + 'endLevel' => 3, + 'showAllChildren' => 1, 'class_sfx' => '', - 'layout' => '_:default', 'cache' => 1, 'cache_time' => 900, 'cachemode' => 'itemid', - 'module_tag' => 'div', + 'module_tag' => 'nav', 'bootstrap_size' => 0, 'header_tag' => 'h3', 'style' => 0, ), ), array( + // The author Menu, for registered users 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MODULES_MODULE_1_TITLE'), 'ordering' => 1, 'position' => 'top-a', @@ -799,34 +982,40 @@ public function onAjaxSampledataApplyStep3() 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MODULES_MODULE_7_TITLE'), 'ordering' => 1, 'position' => 'search', - 'module' => 'mod_search', + 'module' => 'mod_finder', 'params' => array( - 'width' => 20, - 'button_pos' => 'right', + 'searchfilter' => '', + 'show_autosuggest' => 1, + 'show_advanced' => 0, + 'show_label' => 0, + 'alt_label' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MODULES_MODULE_7_TITLE'), + 'show_button' => 1, 'opensearch' => 1, - 'layout' => '_:default', - 'cache' => 1, - 'cache_time' => 900, - 'cachemode' => 'itemid', + 'opensearch_name' => '', + 'set_itemid' => 0, + 'layout' => '_:default', + 'module_tag' => 'search', ), ), array( + // Headder image 'title' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MODULES_MODULE_8_TITLE'), - 'content' => '

', + 'content' => '

' . Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MODULES_MODULE_8_TITLE') . '

', 'ordering' => 1, - 'position' => 'main-top', + 'position' => 'none', 'module' => 'mod_custom', 'showtitle' => 0, 'params' => array( 'prepare_content' => 1, - 'layout' => '_:default', + 'backgroundimage' => 'images\/banners\/banner.jpg', + 'layout' => 'cassiopeia:banner', 'cache' => 1, 'cache_time' => 900, 'cachemode' => 'static', 'module_tag' => 'div', 'bootstrap_size' => 0, 'header_tag' => 'h3', - 'style' => 0, + 'style' => 'none', ), ), array(