From de09fb7d7dc4c85f810d18e37f974deed8e56f11 Mon Sep 17 00:00:00 2001 From: mageprince Date: Thu, 18 Apr 2024 15:24:54 +0530 Subject: [PATCH 1/3] Improvements and tested with Magento 2.4.7 and PHP 8.3 --- Api/Data/FaqGroupInterface.php | 45 ++- Api/Data/FaqGroupSearchResultsInterface.php | 23 +- Api/Data/FaqInterface.php | 41 +- Api/Data/FaqSearchResultsInterface.php | 23 +- Api/FaqGroupRepositoryInterface.php | 26 +- Api/FaqRepositoryInterface.php | 26 +- Block/Adminhtml/Faq/Edit/BackButton.php | 23 +- Block/Adminhtml/Faq/Edit/DeleteButton.php | 23 +- Block/Adminhtml/Faq/Edit/GenericButton.php | 25 +- .../Faq/Edit/SaveAndContinueButton.php | 23 +- Block/Adminhtml/Faq/Edit/SaveButton.php | 23 +- Block/Adminhtml/FaqGroup/Edit/BackButton.php | 23 +- .../Adminhtml/FaqGroup/Edit/DeleteButton.php | 26 +- .../Adminhtml/FaqGroup/Edit/GenericButton.php | 27 +- .../FaqGroup/Edit/SaveAndContinueButton.php | 23 +- Block/Adminhtml/FaqGroup/Edit/SaveButton.php | 26 +- .../System/Config/Field/FaqBlockInfo.php | 21 +- Block/FooterLink.php | 32 +- Block/HeaderLink.php | 31 +- Block/Index/Index.php | 99 +++-- Controller/Adminhtml/Faq/Delete.php | 21 +- Controller/Adminhtml/Faq/Edit.php | 24 +- Controller/Adminhtml/Faq/Faq.php | 21 +- Controller/Adminhtml/Faq/Index.php | 24 +- Controller/Adminhtml/Faq/InlineEdit.php | 24 +- Controller/Adminhtml/Faq/MassDelete.php | 24 +- Controller/Adminhtml/Faq/NewAction.php | 21 +- Controller/Adminhtml/Faq/Save.php | 23 +- Controller/Adminhtml/FaqGroup/Delete.php | 21 +- Controller/Adminhtml/FaqGroup/Edit.php | 24 +- Controller/Adminhtml/FaqGroup/FaqGroup.php | 21 +- Controller/Adminhtml/FaqGroup/Index.php | 23 +- Controller/Adminhtml/FaqGroup/InlineEdit.php | 22 +- Controller/Adminhtml/FaqGroup/MassDelete.php | 22 +- Controller/Adminhtml/FaqGroup/NewAction.php | 21 +- Controller/Adminhtml/FaqGroup/Save.php | 22 +- Controller/Adminhtml/FaqGroup/Upload.php | 23 +- Controller/Index/Ajax.php | 97 ++++- Controller/Index/Index.php | 35 +- Controller/Router.php | 24 +- Helper/Data.php | 44 +- Model/Config/DefaultConfig.php | 59 ++- Model/Config/Source/PageType.php | 36 +- Model/Faq.php | 21 +- Model/Faq/DataProvider.php | 31 +- Model/FaqGroup.php | 21 +- Model/FaqGroup/DataProvider.php | 24 +- Model/FaqGroupRepository.php | 21 +- Model/FaqRepository.php | 21 +- Model/ImageUploader.php | 35 +- Model/ResourceModel/Faq.php | 21 +- Model/ResourceModel/Faq/Collection.php | 26 +- Model/ResourceModel/FaqGroup.php | 21 +- Model/ResourceModel/FaqGroup/Collection.php | 26 +- Observer/ConfigChange.php | 89 +++-- Plugin/Magento/Backend/Model/Menu/Item.php | 32 -- README.md | 76 ---- Setup/InstallData.php | 53 --- Setup/InstallSchema.php | 169 -------- Setup/Patch/Data/SampleFaqData.php | 75 ++++ Setup/UpgradeSchema.php | 95 ----- Ui/Component/Listing/Column/FaqActions.php | 31 +- Ui/Component/Listing/Column/FaqGroup.php | 24 +- .../Listing/Column/FaqGroupActions.php | 29 +- Ui/Component/Listing/Column/FaqIds.php | 24 +- Ui/Component/Listing/Column/GroupIcon.php | 31 +- Ui/Component/Listing/Column/Status.php | 26 +- composer.json | 12 +- etc/acl.xml | 22 +- etc/adminhtml/di.xml | 18 - etc/adminhtml/events.xml | 24 +- etc/adminhtml/menu.xml | 61 ++- etc/adminhtml/routes.xml | 22 +- etc/adminhtml/system.xml | 24 +- etc/config.xml | 22 +- etc/db_schema.xml | 32 ++ etc/di.xml | 22 +- etc/frontend/di.xml | 22 +- etc/frontend/routes.xml | 22 +- etc/module.xml | 24 +- i18n/en_US.csv | 76 ++++ .../layout/mageprince_faq_faq_edit.xml | 22 +- .../layout/mageprince_faq_faq_index.xml | 22 +- .../layout/mageprince_faq_faq_new.xml | 22 +- .../layout/mageprince_faq_faqgroup_edit.xml | 22 +- .../layout/mageprince_faq_faqgroup_index.xml | 22 +- .../layout/mageprince_faq_faqgroup_new.xml | 22 +- .../system/config/Field/FaqBlockInfo.phtml | 2 +- .../ui_component/mageprince_faq_form.xml | 22 +- .../ui_component/mageprince_faq_index.xml | 22 +- .../ui_component/mageprince_faqgroup_form.xml | 22 +- .../mageprince_faqgroup_index.xml | 28 +- .../adminhtml/web/template/image-preview.html | 8 +- view/frontend/layout/default.xml | 24 +- view/frontend/layout/faq_index_index.xml | 22 +- view/frontend/templates/faq_ajax.phtml | 26 +- view/frontend/templates/faq_main.phtml | 36 +- view/frontend/web/css/source/_module.less | 375 +++++++++--------- view/frontend/web/js/faq.js | 2 +- 99 files changed, 2032 insertions(+), 1399 deletions(-) delete mode 100755 Plugin/Magento/Backend/Model/Menu/Item.php delete mode 100755 README.md delete mode 100755 Setup/InstallData.php delete mode 100755 Setup/InstallSchema.php create mode 100644 Setup/Patch/Data/SampleFaqData.php delete mode 100644 Setup/UpgradeSchema.php delete mode 100755 etc/adminhtml/di.xml create mode 100644 etc/db_schema.xml create mode 100644 i18n/en_US.csv diff --git a/Api/Data/FaqGroupInterface.php b/Api/Data/FaqGroupInterface.php index e0750be..619f88d 100755 --- a/Api/Data/FaqGroupInterface.php +++ b/Api/Data/FaqGroupInterface.php @@ -1,34 +1,45 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Api\Data; interface FaqGroupInterface { - const GROUPNAME = 'groupname'; - const FAQIDS = 'faqids'; - const FAQGROUP_ID = 'faqgroup_id'; - const ICON = 'icon'; - const SORTORDER = 'sortorder'; - const STATUS = 'status'; + public const GROUPNAME = 'groupname'; + public const FAQIDS = 'faqids'; + public const FAQGROUP_ID = 'faqgroup_id'; + public const ICON = 'icon'; + public const SORTORDER = 'sortorder'; + public const STATUS = 'status'; /** * Get faqgroup_id + * * @return int */ public function getFaqGroupId(); /** * Set faqgroup_id + * * @param int $faqGroupId * @return \Mageprince\Faq\Api\Data\FaqGroupInterface */ @@ -36,12 +47,14 @@ public function setFaqGroupId($faqGroupId); /** * Get groupname + * * @return int|null */ public function getGroupName(); /** * Set groupname + * * @param string $groupName * @return \Mageprince\Faq\Api\Data\FaqGroupInterface */ @@ -49,12 +62,14 @@ public function setGroupName($groupName); /** * Get icon + * * @return string|null */ public function getIcon(); /** * Set icon + * * @param string $icon * @return \Mageprince\Faq\Api\Data\FaqGroupInterface */ @@ -62,12 +77,14 @@ public function setIcon($icon); /** * Get faq ids + * * @return string|null */ public function getFaqIds(); /** * Set faq ids + * * @param string $faqIds * @return \Mageprince\Faq\Api\Data\FaqGroupInterface */ @@ -75,12 +92,14 @@ public function setFaqIds($faqIds); /** * Get sort order + * * @return string|null */ public function getSortOrder(); /** * Set sort order + * * @param int $sortOrder * @return \Mageprince\Faq\Api\Data\FaqGroupInterface */ @@ -88,12 +107,14 @@ public function setSortOrder($sortOrder); /** * Get status + * * @return string|null */ public function getStatus(); /** * Set status + * * @param string $status * @return \Mageprince\Faq\Api\Data\FaqGroupInterface */ diff --git a/Api/Data/FaqGroupSearchResultsInterface.php b/Api/Data/FaqGroupSearchResultsInterface.php index 64461ff..0732cdd 100755 --- a/Api/Data/FaqGroupSearchResultsInterface.php +++ b/Api/Data/FaqGroupSearchResultsInterface.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Api\Data; @@ -18,12 +27,14 @@ interface FaqGroupSearchResultsInterface extends SearchResultsInterface { /** * Get FaqGroup list. + * * @return \Mageprince\Faq\Api\Data\FaqGroupInterface[] */ public function getItems(); /** * Set FaqGroup list. + * * @param \Mageprince\Faq\Api\Data\FaqGroupInterface[] $items * @return $this */ diff --git a/Api/Data/FaqInterface.php b/Api/Data/FaqInterface.php index 7f142a6..4769e64 100755 --- a/Api/Data/FaqInterface.php +++ b/Api/Data/FaqInterface.php @@ -1,33 +1,44 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Api\Data; interface FaqInterface { - const TITLE = 'title'; - const SORTORDER = 'sortorder'; - const FAQ_ID = 'faq_id'; - const CONTENT = 'content'; - const STATUS = 'status'; + public const TITLE = 'title'; + public const SORTORDER = 'sortorder'; + public const FAQ_ID = 'faq_id'; + public const CONTENT = 'content'; + public const STATUS = 'status'; /** * Get faq_id + * * @return int */ public function getFaqId(); /** * Set faq_id + * * @param int $faqId * @return \Mageprince\Faq\Api\Data\FaqInterface */ @@ -35,12 +46,14 @@ public function setFaqId($faqId); /** * Get title + * * @return string|null */ public function getTitle(); /** * Set title + * * @param string $title * @return \Mageprince\Faq\Api\Data\FaqInterface */ @@ -48,12 +61,14 @@ public function setTitle($title); /** * Get content + * * @return string|null */ public function getContent(); /** * Set content + * * @param string $content * @return \Mageprince\Faq\Api\Data\FaqInterface */ @@ -61,12 +76,14 @@ public function setContent($content); /** * Get sortorder + * * @return string|null */ public function getSortOrder(); /** * Set sortorder + * * @param string $sortOrder * @return \Mageprince\Faq\Api\Data\FaqInterface */ @@ -74,12 +91,14 @@ public function setSortOrder($sortOrder); /** * Get status + * * @return string|null */ public function getStatus(); /** * Set status + * * @param string $status * @return \Mageprince\Faq\Api\Data\FaqInterface */ diff --git a/Api/Data/FaqSearchResultsInterface.php b/Api/Data/FaqSearchResultsInterface.php index 74bf671..0d3bfdc 100755 --- a/Api/Data/FaqSearchResultsInterface.php +++ b/Api/Data/FaqSearchResultsInterface.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Api\Data; @@ -18,12 +27,14 @@ interface FaqSearchResultsInterface extends SearchResultsInterface { /** * Get Faq list. + * * @return \Mageprince\Faq\Api\Data\FaqInterface[] */ public function getItems(); /** * Set title list. + * * @param \Mageprince\Faq\Api\Data\FaqInterface[] $items * @return $this */ diff --git a/Api/FaqGroupRepositoryInterface.php b/Api/FaqGroupRepositoryInterface.php index 471cd9f..92829ed 100755 --- a/Api/FaqGroupRepositoryInterface.php +++ b/Api/FaqGroupRepositoryInterface.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Api; @@ -16,6 +25,7 @@ interface FaqGroupRepositoryInterface { /** * Save FaqGroup + * * @param \Mageprince\Faq\Api\Data\FaqGroupInterface $faqGroup * @return \Mageprince\Faq\Api\Data\FaqGroupInterface * @throws \Magento\Framework\Exception\LocalizedException @@ -26,6 +36,7 @@ public function save( /** * Retrieve FaqGroup + * * @param int $faqGroupId * @return \Mageprince\Faq\Api\Data\FaqGroupInterface * @throws \Magento\Framework\Exception\LocalizedException @@ -34,6 +45,7 @@ public function getById($faqGroupId); /** * Retrieve FaqGroup matching the specified criteria. + * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Mageprince\Faq\Api\Data\FaqGroupSearchResultsInterface * @throws \Magento\Framework\Exception\LocalizedException @@ -44,6 +56,7 @@ public function getList( /** * Delete FaqGroup + * * @param \Mageprince\Faq\Api\Data\FaqGroupInterface $faqGroup * @return bool true on success * @throws \Magento\Framework\Exception\LocalizedException @@ -54,6 +67,7 @@ public function delete( /** * Delete FaqGroup by ID + * * @param int $faqGroupId * @return bool true on success * @throws \Magento\Framework\Exception\NoSuchEntityException diff --git a/Api/FaqRepositoryInterface.php b/Api/FaqRepositoryInterface.php index a962e7a..b8a9873 100755 --- a/Api/FaqRepositoryInterface.php +++ b/Api/FaqRepositoryInterface.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Api; @@ -16,6 +25,7 @@ interface FaqRepositoryInterface { /** * Save Faq + * * @param \Mageprince\Faq\Api\Data\FaqInterface $faq * @return \Mageprince\Faq\Api\Data\FaqInterface * @throws \Magento\Framework\Exception\LocalizedException @@ -24,6 +34,7 @@ public function save(\Mageprince\Faq\Api\Data\FaqInterface $faq); /** * Retrieve Faq + * * @param int $faqId * @return \Mageprince\Faq\Api\Data\FaqInterface * @throws \Magento\Framework\Exception\LocalizedException @@ -32,6 +43,7 @@ public function getById($faqId); /** * Retrieve Faq matching the specified criteria. + * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Mageprince\Faq\Api\Data\FaqSearchResultsInterface * @throws \Magento\Framework\Exception\LocalizedException @@ -42,6 +54,7 @@ public function getList( /** * Delete Faq + * * @param \Mageprince\Faq\Api\Data\FaqInterface $faq * @return bool true on success * @throws \Magento\Framework\Exception\LocalizedException @@ -50,6 +63,7 @@ public function delete(\Mageprince\Faq\Api\Data\FaqInterface $faq); /** * Delete Faq by ID + * * @param int $faqId * @return bool true on success * @throws \Magento\Framework\Exception\NoSuchEntityException diff --git a/Block/Adminhtml/Faq/Edit/BackButton.php b/Block/Adminhtml/Faq/Edit/BackButton.php index 7286acb..b90da97 100755 --- a/Block/Adminhtml/Faq/Edit/BackButton.php +++ b/Block/Adminhtml/Faq/Edit/BackButton.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\Faq\Edit; @@ -18,6 +27,8 @@ class BackButton extends GenericButton implements ButtonProviderInterface { /** + * Back button + * * @return array */ public function getButtonData() diff --git a/Block/Adminhtml/Faq/Edit/DeleteButton.php b/Block/Adminhtml/Faq/Edit/DeleteButton.php index 12233e4..e8db049 100755 --- a/Block/Adminhtml/Faq/Edit/DeleteButton.php +++ b/Block/Adminhtml/Faq/Edit/DeleteButton.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\Faq\Edit; @@ -18,6 +27,8 @@ class DeleteButton extends GenericButton implements ButtonProviderInterface { /** + * Delete button + * * @return array */ public function getButtonData() diff --git a/Block/Adminhtml/Faq/Edit/GenericButton.php b/Block/Adminhtml/Faq/Edit/GenericButton.php index a41570f..796cac1 100755 --- a/Block/Adminhtml/Faq/Edit/GenericButton.php +++ b/Block/Adminhtml/Faq/Edit/GenericButton.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\Faq\Edit; @@ -16,6 +25,10 @@ abstract class GenericButton { + /** + * @var Context + */ + protected $context; /** * @param \Magento\Backend\Block\Widget\Context $context diff --git a/Block/Adminhtml/Faq/Edit/SaveAndContinueButton.php b/Block/Adminhtml/Faq/Edit/SaveAndContinueButton.php index cbd1277..cb87967 100755 --- a/Block/Adminhtml/Faq/Edit/SaveAndContinueButton.php +++ b/Block/Adminhtml/Faq/Edit/SaveAndContinueButton.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\Faq\Edit; @@ -18,6 +27,8 @@ class SaveAndContinueButton extends GenericButton implements ButtonProviderInter { /** + * Save and continue button + * * @return array */ public function getButtonData() diff --git a/Block/Adminhtml/Faq/Edit/SaveButton.php b/Block/Adminhtml/Faq/Edit/SaveButton.php index 10b7ae0..5770c6f 100755 --- a/Block/Adminhtml/Faq/Edit/SaveButton.php +++ b/Block/Adminhtml/Faq/Edit/SaveButton.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\Faq\Edit; @@ -18,6 +27,8 @@ class SaveButton extends GenericButton implements ButtonProviderInterface { /** + * Save button + * * @return array */ public function getButtonData() diff --git a/Block/Adminhtml/FaqGroup/Edit/BackButton.php b/Block/Adminhtml/FaqGroup/Edit/BackButton.php index fb23ad0..78215a5 100755 --- a/Block/Adminhtml/FaqGroup/Edit/BackButton.php +++ b/Block/Adminhtml/FaqGroup/Edit/BackButton.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\FaqGroup\Edit; @@ -18,6 +27,8 @@ class BackButton extends GenericButton implements ButtonProviderInterface { /** + * Back button + * * @return array */ public function getButtonData() diff --git a/Block/Adminhtml/FaqGroup/Edit/DeleteButton.php b/Block/Adminhtml/FaqGroup/Edit/DeleteButton.php index 75e00f9..b34c676 100755 --- a/Block/Adminhtml/FaqGroup/Edit/DeleteButton.php +++ b/Block/Adminhtml/FaqGroup/Edit/DeleteButton.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\FaqGroup\Edit; @@ -16,8 +25,9 @@ class DeleteButton extends GenericButton implements ButtonProviderInterface { - /** + * Delete button + * * @return array */ public function getButtonData() @@ -25,7 +35,7 @@ public function getButtonData() $data = []; if ($this->getModelId()) { $data = [ - 'label' => __('Delete FAQgroup'), + 'label' => __('Delete FAQ group'), 'class' => 'delete', 'on_click' => 'deleteConfirm(\'' . __( 'Are you sure you want to do this?' diff --git a/Block/Adminhtml/FaqGroup/Edit/GenericButton.php b/Block/Adminhtml/FaqGroup/Edit/GenericButton.php index 2d2ab40..3338f44 100755 --- a/Block/Adminhtml/FaqGroup/Edit/GenericButton.php +++ b/Block/Adminhtml/FaqGroup/Edit/GenericButton.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\FaqGroup\Edit; @@ -16,11 +25,13 @@ abstract class GenericButton { - + /** + * @var Context + */ private $context; /** - * @param \Magento\Backend\Block\Widget\Context $context + * @param Context $context */ public function __construct(Context $context) { diff --git a/Block/Adminhtml/FaqGroup/Edit/SaveAndContinueButton.php b/Block/Adminhtml/FaqGroup/Edit/SaveAndContinueButton.php index 53bc187..5f9d40c 100755 --- a/Block/Adminhtml/FaqGroup/Edit/SaveAndContinueButton.php +++ b/Block/Adminhtml/FaqGroup/Edit/SaveAndContinueButton.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\FaqGroup\Edit; @@ -18,6 +27,8 @@ class SaveAndContinueButton extends GenericButton implements ButtonProviderInter { /** + * Save and continue button + * * @return array */ public function getButtonData() diff --git a/Block/Adminhtml/FaqGroup/Edit/SaveButton.php b/Block/Adminhtml/FaqGroup/Edit/SaveButton.php index cadc90f..7351e22 100755 --- a/Block/Adminhtml/FaqGroup/Edit/SaveButton.php +++ b/Block/Adminhtml/FaqGroup/Edit/SaveButton.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\FaqGroup\Edit; @@ -16,14 +25,15 @@ class SaveButton extends GenericButton implements ButtonProviderInterface { - /** + * Save button + * * @return array */ public function getButtonData() { return [ - 'label' => __('Save FAQgroup'), + 'label' => __('Save FAQ Group'), 'class' => 'save primary', 'data_attribute' => [ 'mage-init' => ['button' => ['event' => 'save']], diff --git a/Block/Adminhtml/System/Config/Field/FaqBlockInfo.php b/Block/Adminhtml/System/Config/Field/FaqBlockInfo.php index eea47b7..fb4c254 100644 --- a/Block/Adminhtml/System/Config/Field/FaqBlockInfo.php +++ b/Block/Adminhtml/System/Config/Field/FaqBlockInfo.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Adminhtml\System\Config\Field; diff --git a/Block/FooterLink.php b/Block/FooterLink.php index 5e4059b..59d0bf1 100755 --- a/Block/FooterLink.php +++ b/Block/FooterLink.php @@ -1,32 +1,48 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block; use Magento\Framework\View\Element\Html\Link; use Magento\Store\Model\ScopeInterface; +use Mageprince\Faq\Model\Config\DefaultConfig; class FooterLink extends Link { + /** + * Render footer link HTML + * + * @return string + */ public function _toHtml() { $isEnable = $this->_scopeConfig->isSetFlag( - 'faqtab/general/enable', + DefaultConfig::CONFIG_PATH_IS_ENABLE, ScopeInterface::SCOPE_STORE ); $isFooterLinkEnable = $this->_scopeConfig->isSetFlag( - 'faqtab/design/footerlink', + DefaultConfig::CONFIG_PATH_FOOTER_LINK, ScopeInterface::SCOPE_STORE ); + if (!$isEnable || !$isFooterLinkEnable) { return ''; } diff --git a/Block/HeaderLink.php b/Block/HeaderLink.php index a32e960..b8270a7 100755 --- a/Block/HeaderLink.php +++ b/Block/HeaderLink.php @@ -1,30 +1,45 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block; use Magento\Framework\View\Element\Html\Link; use Magento\Store\Model\ScopeInterface; +use Mageprince\Faq\Model\Config\DefaultConfig; class HeaderLink extends Link { + /** + * Render header link HTML + * + * @return string + */ public function _toHtml() { $isEnable = $this->_scopeConfig->isSetFlag( - 'faqtab/general/enable', + DefaultConfig::CONFIG_PATH_IS_ENABLE, ScopeInterface::SCOPE_STORE ); $isHeaderLinkEnable = $this->_scopeConfig->isSetFlag( - 'faqtab/design/headerlink', + DefaultConfig::CONFIG_PATH_HEADER_LINK, ScopeInterface::SCOPE_STORE ); if (!$isEnable || !$isHeaderLinkEnable) { diff --git a/Block/Index/Index.php b/Block/Index/Index.php index 3d3d33e..b3191c1 100755 --- a/Block/Index/Index.php +++ b/Block/Index/Index.php @@ -1,31 +1,38 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Block\Index; use Magento\Cms\Model\Template\FilterProvider; -use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Framework\UrlInterface; use Magento\Framework\View\Element\Template; use Magento\Store\Model\ScopeInterface; -use Magento\Store\Model\StoreManagerInterface; use Magento\Widget\Block\BlockInterface; use Mageprince\Faq\Api\Data\FaqGroupInterface; use Mageprince\Faq\Api\FaqGroupRepositoryInterface; use Mageprince\Faq\Helper\Data as HelperData; use Mageprince\Faq\Model\Config\DefaultConfig; -use Mageprince\Faq\Model\FaqGroupFactory; use Mageprince\Faq\Model\ResourceModel\Faq\CollectionFactory; use Mageprince\Faq\Model\ResourceModel\FaqGroup\Collection as FaqGroupCollection; use Mageprince\Faq\Model\ResourceModel\FaqGroup\CollectionFactory as FaqGroupCollectionFactory; @@ -34,9 +41,10 @@ class Index extends Template implements BlockInterface { /** * Default faq template + * * @var string */ - protected $_template = 'Mageprince_Faq::faq_main.phtml'; + protected $_template = DefaultConfig::FAQ_MAIN_TEMPLATE_FILE; /** * @var CollectionFactory @@ -48,26 +56,11 @@ class Index extends Template implements BlockInterface */ protected $faqGroupCollectionFactory; - /** - * @var FaqGroupFactory - */ - protected $faqGroupFactory; - - /** - * @var StoreManagerInterface - */ - protected $storeManager; - /** * @var HelperData */ protected $customerSession; - /** - * @var ScopeConfigInterface - */ - protected $scopeConfig; - /** * @var HelperData */ @@ -85,12 +78,10 @@ class Index extends Template implements BlockInterface /** * Index constructor. - * * @param Template\Context $context * @param CollectionFactory $faqCollectionFactory * @param FaqGroupRepositoryInterface $faqGroupRepository * @param FaqGroupCollectionFactory $faqGroupCollectionFactory - * @param FaqGroupFactory $faqGroupFactory * @param FilterProvider $filterProvider * @param HelperData $helper */ @@ -99,16 +90,12 @@ public function __construct( CollectionFactory $faqCollectionFactory, FaqGroupRepositoryInterface $faqGroupRepository, FaqGroupCollectionFactory $faqGroupCollectionFactory, - FaqGroupFactory $faqGroupFactory, FilterProvider $filterProvider, HelperData $helper ) { $this->faqCollectionFactory = $faqCollectionFactory; $this->faqGroupCollectionFactory = $faqGroupCollectionFactory; $this->faqGroupRepository = $faqGroupRepository; - $this->faqGroupFactory = $faqGroupFactory; - $this->storeManager = $context->getStoreManager(); - $this->scopeConfig = $context->getScopeConfig(); $this->helper = $helper; $this->filterProvider = $filterProvider; parent::__construct($context); @@ -117,7 +104,7 @@ public function __construct( /** * Get faq collection * - * @param $group + * @param int $group * @return \Mageprince\Faq\Model\ResourceModel\Faq\Collection * @throws NoSuchEntityException */ @@ -154,7 +141,7 @@ public function getFaqGroupCollection() /** * Filter collection data * - * @param $collection + * @param AbstractCollection $collection * @throws NoSuchEntityException */ private function filterCollectionData($collection) @@ -180,7 +167,7 @@ private function filterCollectionData($collection) /** * Get group by id * - * @param $groupId + * @param int $groupId * @return FaqGroupInterface * @throws LocalizedException */ @@ -192,40 +179,50 @@ public function getGroupById($groupId) /** * Filter faq content * - * @param $string + * @param string $string * @return string - * @throws \Exception */ public function filterOutputHtml($string) { - return $this->filterProvider->getPageFilter()->filter($string); + $output = ''; + try { + $output = $this->filterProvider->getPageFilter()->filter($string); + } catch (\Exception $e) { + $this->_logger->error('Faq filter output error: ' . $e->getMessage()); + } + return $output; } /** * Get icon image url * - * @param $icon + * @param string $icon * @return string - * @throws NoSuchEntityException */ public function getImageUrl($icon) { - $mediaUrl = $this->storeManager - ->getStore() - ->getBaseUrl(UrlInterface::URL_TYPE_MEDIA); - $imageUrl = $mediaUrl . 'faq/tmp/icon/' . $icon; + $imageUrl = ''; + try { + $mediaUrl = $this->_storeManager + ->getStore() + ->getBaseUrl(UrlInterface::URL_TYPE_MEDIA); + $imageUrl = $mediaUrl . DefaultConfig::ICON_TMP_PATH . $icon; + } catch (\Exception $e) { + $this->_logger->error('Faq get image error:' . $e->getMessage()); + } + return $imageUrl; } /** * Get config value * - * @param $config + * @param string $config * @return mixed */ public function getConfig($config) { - return $this->scopeConfig->getValue( + return $this->_scopeConfig->getValue( $config, ScopeInterface::SCOPE_STORE ); @@ -239,7 +236,7 @@ public function getConfig($config) */ public function getCurrentStore() { - return $this->storeManager->getStore()->getId(); + return $this->_storeManager->getStore()->getId(); } /** @@ -287,10 +284,10 @@ public function isShowGroupTitle() */ public function getPageTypeAction() { - if ($this->getPageType() == 'ajax') { - $pageType = 'ajax'; - } elseif ($this->getPageType() == 'scroll') { - $pageType = 'scroll'; + if ($this->getPageType() == DefaultConfig::FAQ_PAGE_TYPE_AJAX) { + $pageType = DefaultConfig::FAQ_PAGE_TYPE_AJAX; + } elseif ($this->getPageType() == DefaultConfig::FAQ_PAGE_TYPE_SCROLL) { + $pageType = DefaultConfig::FAQ_PAGE_TYPE_SCROLL; } else { $pageType = $this->getConfig(DefaultConfig::CONFIG_PATH_PAGE_TYPE); } @@ -319,6 +316,6 @@ public function isCollapseExpandEnabled() */ public function getAjaxUrl() { - return $this->getUrl('faq/index/ajax'); + return $this->getUrl(DefaultConfig::FAQ_PAGE_AJAX_URL); } } diff --git a/Controller/Adminhtml/Faq/Delete.php b/Controller/Adminhtml/Faq/Delete.php index 9cb46c8..23d06dc 100755 --- a/Controller/Adminhtml/Faq/Delete.php +++ b/Controller/Adminhtml/Faq/Delete.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\Faq; diff --git a/Controller/Adminhtml/Faq/Edit.php b/Controller/Adminhtml/Faq/Edit.php index 8c967bc..bdf6a58 100755 --- a/Controller/Adminhtml/Faq/Edit.php +++ b/Controller/Adminhtml/Faq/Edit.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\Faq; @@ -30,8 +39,7 @@ class Edit extends Faq protected $faqRepository; /** - * Index constructor. - * + * Edit constructor. * @param Context $context * @param PageFactory $resultPageFactory * @param FaqRepository $faqRepository diff --git a/Controller/Adminhtml/Faq/Faq.php b/Controller/Adminhtml/Faq/Faq.php index b0b3de0..61ca4c0 100644 --- a/Controller/Adminhtml/Faq/Faq.php +++ b/Controller/Adminhtml/Faq/Faq.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\Faq; diff --git a/Controller/Adminhtml/Faq/Index.php b/Controller/Adminhtml/Faq/Index.php index b00d882..40cfed4 100755 --- a/Controller/Adminhtml/Faq/Index.php +++ b/Controller/Adminhtml/Faq/Index.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\Faq; @@ -23,8 +32,7 @@ class Index extends Faq protected $resultPageFactory; /** - * Constructor - * + * Index constructor. * @param Context $context * @param PageFactory $resultPageFactory */ diff --git a/Controller/Adminhtml/Faq/InlineEdit.php b/Controller/Adminhtml/Faq/InlineEdit.php index cce24cc..73c47a7 100755 --- a/Controller/Adminhtml/Faq/InlineEdit.php +++ b/Controller/Adminhtml/Faq/InlineEdit.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\Faq; @@ -32,7 +41,6 @@ class InlineEdit extends Action /** * InlineEdit constructor. - * * @param Action\Context $context * @param JsonFactory $jsonFactory * @param FaqRepository $faqRepository @@ -48,7 +56,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function _isAllowed() { diff --git a/Controller/Adminhtml/Faq/MassDelete.php b/Controller/Adminhtml/Faq/MassDelete.php index 6ac25b5..1291265 100755 --- a/Controller/Adminhtml/Faq/MassDelete.php +++ b/Controller/Adminhtml/Faq/MassDelete.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\Faq; @@ -30,7 +39,6 @@ class MassDelete extends Faq /** * MassDelete constructor. - * * @param Filter $filter * @param CollectionFactory $collectionFactory * @param Action\Context $context @@ -46,7 +54,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function _isAllowed() { diff --git a/Controller/Adminhtml/Faq/NewAction.php b/Controller/Adminhtml/Faq/NewAction.php index 12da492..79aa0b0 100755 --- a/Controller/Adminhtml/Faq/NewAction.php +++ b/Controller/Adminhtml/Faq/NewAction.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\Faq; diff --git a/Controller/Adminhtml/Faq/Save.php b/Controller/Adminhtml/Faq/Save.php index c3931ea..2dc2ea9 100755 --- a/Controller/Adminhtml/Faq/Save.php +++ b/Controller/Adminhtml/Faq/Save.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\Faq; @@ -101,7 +110,7 @@ public function execute() /** * Filter faq data * - * @param $data + * @param array $data * @return mixed */ protected function _filterFaqData($data) diff --git a/Controller/Adminhtml/FaqGroup/Delete.php b/Controller/Adminhtml/FaqGroup/Delete.php index 7f5b5a0..d4ed3b0 100755 --- a/Controller/Adminhtml/FaqGroup/Delete.php +++ b/Controller/Adminhtml/FaqGroup/Delete.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; diff --git a/Controller/Adminhtml/FaqGroup/Edit.php b/Controller/Adminhtml/FaqGroup/Edit.php index 379dd7b..fbb01c4 100755 --- a/Controller/Adminhtml/FaqGroup/Edit.php +++ b/Controller/Adminhtml/FaqGroup/Edit.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; @@ -30,8 +39,7 @@ class Edit extends FaqGroup protected $faqGroupRepository; /** - * Index constructor. - * + * Edit constructor. * @param Context $context * @param PageFactory $resultPageFactory * @param FaqGroupRepository $faqGroupRepository diff --git a/Controller/Adminhtml/FaqGroup/FaqGroup.php b/Controller/Adminhtml/FaqGroup/FaqGroup.php index b8cb5e7..9135986 100644 --- a/Controller/Adminhtml/FaqGroup/FaqGroup.php +++ b/Controller/Adminhtml/FaqGroup/FaqGroup.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; diff --git a/Controller/Adminhtml/FaqGroup/Index.php b/Controller/Adminhtml/FaqGroup/Index.php index c34d2ee..12172e6 100755 --- a/Controller/Adminhtml/FaqGroup/Index.php +++ b/Controller/Adminhtml/FaqGroup/Index.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; @@ -25,7 +34,6 @@ class Index extends FaqGroup /** * Index constructor. - * * @param Context $context * @param PageFactory $resultPageFactory */ @@ -37,7 +45,6 @@ public function __construct( parent::__construct($context); } - /** * Index action * diff --git a/Controller/Adminhtml/FaqGroup/InlineEdit.php b/Controller/Adminhtml/FaqGroup/InlineEdit.php index add7079..a1d9283 100755 --- a/Controller/Adminhtml/FaqGroup/InlineEdit.php +++ b/Controller/Adminhtml/FaqGroup/InlineEdit.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; @@ -32,7 +41,6 @@ class InlineEdit extends Action /** * InlineEdit constructor. - * * @param Action\Context $context * @param JsonFactory $jsonFactory * @param FaqGroupRepository $faqGroupRepository diff --git a/Controller/Adminhtml/FaqGroup/MassDelete.php b/Controller/Adminhtml/FaqGroup/MassDelete.php index 1fdb2c9..8fde79a 100755 --- a/Controller/Adminhtml/FaqGroup/MassDelete.php +++ b/Controller/Adminhtml/FaqGroup/MassDelete.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; @@ -30,7 +39,6 @@ class MassDelete extends FaqGroup /** * MassDelete constructor. - * * @param Filter $filter * @param CollectionFactory $collectionFactory * @param Action\Context $context diff --git a/Controller/Adminhtml/FaqGroup/NewAction.php b/Controller/Adminhtml/FaqGroup/NewAction.php index 0351a15..b97f176 100755 --- a/Controller/Adminhtml/FaqGroup/NewAction.php +++ b/Controller/Adminhtml/FaqGroup/NewAction.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; diff --git a/Controller/Adminhtml/FaqGroup/Save.php b/Controller/Adminhtml/FaqGroup/Save.php index d937f91..c7ec405 100755 --- a/Controller/Adminhtml/FaqGroup/Save.php +++ b/Controller/Adminhtml/FaqGroup/Save.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; @@ -45,7 +54,6 @@ class Save extends FaqGroup /** * Save constructor. - * * @param Action\Context $context * @param FaqGroupFactory $faqGroupFactory * @param DataPersistorInterface $dataPersistor diff --git a/Controller/Adminhtml/FaqGroup/Upload.php b/Controller/Adminhtml/FaqGroup/Upload.php index b9a23d6..c884259 100755 --- a/Controller/Adminhtml/FaqGroup/Upload.php +++ b/Controller/Adminhtml/FaqGroup/Upload.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; @@ -20,8 +29,6 @@ class Upload extends FaqGroup { /** - * Image uploader - * * @var ImageUploader */ public $imageUploader; diff --git a/Controller/Index/Ajax.php b/Controller/Index/Ajax.php index a699d07..a0ec606 100755 --- a/Controller/Index/Ajax.php +++ b/Controller/Index/Ajax.php @@ -1,26 +1,43 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Index; use Magento\Framework\App\Action; +use Magento\Framework\App\Cache\Type\Block as TypeBlock; +use Magento\Framework\App\CacheInterface; use Magento\Framework\Controller\Result\JsonFactory; use Magento\Framework\Controller\ResultInterface; use Magento\Framework\View\Result\PageFactory; use Mageprince\Faq\Block\Index\Index as FaqBlock; use Mageprince\Faq\Helper\Data; +use Mageprince\Faq\Model\Config\DefaultConfig; class Ajax extends Action\Action { + /** + * Cache key + */ + private const FAQ_GROUP_CACHE_KEY = 'mageprince_faq_group_'; + /** * @var PageFactory */ @@ -36,43 +53,85 @@ class Ajax extends Action\Action */ protected $helper; + /** + * @var CacheInterface + */ + protected $cache; + /** * Ajax constructor. * @param Action\Context $context * @param Data $helper * @param PageFactory $resultPageFactory * @param JsonFactory $resultJsonFactory + * @param CacheInterface $cache */ public function __construct( Action\Context $context, Data $helper, PageFactory $resultPageFactory, - JsonFactory $resultJsonFactory + JsonFactory $resultJsonFactory, + CacheInterface $cache ) { $this->helper = $helper; $this->resultPageFactory = $resultPageFactory; $this->resultJsonFactory = $resultJsonFactory; parent::__construct($context); + $this->cache = $cache; } /** - * Execute view action + * Ajax request * - * @return ResultInterface + * @return ResultInterface|void */ public function execute() { - $resultPage = $this->resultPageFactory->create(); - $groupId = $this->getRequest()->getParam('groupId'); - $block = $resultPage->getLayout() - ->createBlock(FaqBlock::class) - ->setTemplate('Mageprince_Faq::faq_ajax.phtml') - ->setGroupId($groupId) - ->toHtml(); + if ($this->getRequest()->isXmlHttpRequest()) { + $groupId = $this->getRequest()->getParam('groupId'); + $faqHtml = $this->getFaqHtml($groupId); + $resultJson = $this->resultJsonFactory->create(); + $resultJson->setData(['faq' => $faqHtml]); + return $resultJson; + } + } - $resultJson = $this->resultJsonFactory->create(); - $resultJson->setData(['faq' => $block]); + /** + * Get faq html from cache + * + * @param int $groupId + * @return string + */ + protected function getFaqHtml($groupId) + { + $faqHtml = $this->cache->load($this->getCacheKey($groupId)); + if (false === $faqHtml) { + $resultPage = $this->resultPageFactory->create(); + $faqHtml = $resultPage->getLayout() + ->createBlock(FaqBlock::class) + ->setTemplate(DefaultConfig::FAQ_AJAX_TEMPLATE_FILE) + ->setGroupId($groupId) + ->toHtml(); - return $resultJson; + $this->cache->save( + $faqHtml, + $this->getCacheKey($groupId), + [ + TypeBlock::TYPE_IDENTIFIER + ] + ); + } + return $faqHtml; + } + + /** + * Retrieve cache key + * + * @param int $groupId + * @return string + */ + protected function getCacheKey($groupId) + { + return self::FAQ_GROUP_CACHE_KEY . $groupId; } } diff --git a/Controller/Index/Index.php b/Controller/Index/Index.php index 42f10b3..94865b4 100755 --- a/Controller/Index/Index.php +++ b/Controller/Index/Index.php @@ -1,24 +1,35 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller\Index; +use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\Controller\ResultInterface; use Magento\Framework\View\Result\PageFactory; use Magento\Theme\Block\Html\Title as HtmlTitle; use Mageprince\Faq\Helper\Data; +use Mageprince\Faq\Model\Config\DefaultConfig; -class Index extends \Magento\Framework\App\Action\Action +class Index extends Action { /** * @var PageFactory @@ -54,17 +65,17 @@ public function __construct( public function execute() { $resultPage = $this->resultPageFactory->create(); - if ($this->helper->getConfig('faqtab/general/enable')) { + if ($this->helper->isEnable()) { $pageMainTitle = $resultPage->getLayout()->getBlock('page.main.title'); - $pageTitle = $this->helper->getConfig('faqtab/general/page_title'); + $pageTitle = $this->helper->getConfig(DefaultConfig::CONFIG_PATH_PAGE_TITLE); if ($pageMainTitle && $pageMainTitle instanceof HtmlTitle) { $pageMainTitle->setPageTitle($pageTitle); } - $metaTitleConfig = $this->helper->getConfig('faqtab/seo/meta_title'); - $metaKeywordsConfig = $this->helper->getConfig('faqtab/seo/meta_keywords'); - $metaDescriptionConfig = $this->helper->getConfig('faqtab/seo/meta_description'); + $metaTitleConfig = $this->helper->getConfig(DefaultConfig::FAQ_META_TITLE); + $metaKeywordsConfig = $this->helper->getConfig(DefaultConfig::FAQ_META_KEYWORD); + $metaDescriptionConfig = $this->helper->getConfig(DefaultConfig::FAQ_META_DESCRIPTION); $resultPage->getConfig()->getTitle()->set($metaTitleConfig); $resultPage->getConfig()->setDescription($metaDescriptionConfig); diff --git a/Controller/Router.php b/Controller/Router.php index e9d88c4..4cf5b00 100755 --- a/Controller/Router.php +++ b/Controller/Router.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Controller; @@ -35,7 +44,6 @@ class Router implements RouterInterface /** * Router constructor. - * * @param ActionFactory $actionFactory * @param ScopeConfigInterface $scopeConfig */ @@ -48,6 +56,8 @@ public function __construct( } /** + * Faq router + * * @param RequestInterface $request * @return ActionInterface|null */ diff --git a/Helper/Data.php b/Helper/Data.php index a83d9b2..3b72389 100755 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Helper; @@ -16,7 +25,6 @@ use Magento\Framework\App\Helper\AbstractHelper; use Magento\Framework\App\Helper\Context; use Magento\Store\Model\ScopeInterface; -use Mageprince\Base\Helper\Data as BaseHelper; use Mageprince\Faq\Model\Config\DefaultConfig; use Magento\Framework\App\Http\Context as AuthContext; @@ -32,34 +40,27 @@ class Data extends AbstractHelper */ protected $authContext; - /** - * @var BaseHelper - */ - protected $baseHelper; - /** * Data constructor. * * @param Context $context * @param CustomerSession $customerSession * @param AuthContext $authContext - * @param BaseHelper $baseHelper */ public function __construct( Context $context, CustomerSession $customerSession, - AuthContext $authContext, - BaseHelper $baseHelper + AuthContext $authContext ) { $this->customerSession = $customerSession; $this->authContext = $authContext; - $this->baseHelper = $baseHelper; parent::__construct($context); } /** * Get config path - * @param $config + * + * @param string $config * @return mixed */ public function getConfig($config) @@ -72,6 +73,7 @@ public function getConfig($config) /** * Get faq url + * * @return string */ public function getFaqUrl() @@ -97,12 +99,16 @@ public function getCustomerGroupId() /** * Check is block data * - * @param $data + * @param string $data * @return bool */ public function checkBlockData($data) { - return $this->baseHelper->checkBlockData($data); + if ($data == '1') { + return true; + } elseif ($data == '0') { + return false; + } } /** diff --git a/Model/Config/DefaultConfig.php b/Model/Config/DefaultConfig.php index 371966e..de9ec85 100755 --- a/Model/Config/DefaultConfig.php +++ b/Model/Config/DefaultConfig.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model\Config; @@ -15,32 +24,40 @@ class DefaultConfig { /** - * Is enabled module config path - */ - const CONFIG_PATH_IS_ENABLE = 'faqtab/general/enable'; - - /** - * Is enable show group config path + * FAQ module config paths */ - const CONFIG_PATH_IS_SHOW_GROUP = 'faqtab/design/showgroup'; + public const CONFIG_PATH_IS_ENABLE = 'faqtab/general/enable'; + public const CONFIG_PATH_PAGE_TITLE = 'faqtab/general/page_title'; + public const CONFIG_PATH_IS_SHOW_GROUP = 'faqtab/design/showgroup'; + public const CONFIG_PATH_IS_SHOW_GROUP_TITLE = 'faqtab/design/showgrouptitle'; + public const CONFIG_PATH_PAGE_TYPE = 'faqtab/design/page_type'; + public const CONFIG_PATH_FOOTER_LINK = 'faqtab/design/footerlink'; + public const CONFIG_PATH_HEADER_LINK = 'faqtab/design/headerlink'; + public const CONFIG_PATH_IS_ENABLED_COLLAPSE_EXPAND = 'faqtab/design/is_collapse_expand'; + public const FAQ_URL_CONFIG_PATH = 'faqtab/seo/faq_url'; + public const FAQ_META_TITLE = 'faqtab/seo/meta_title'; + public const FAQ_META_KEYWORD = 'faqtab/seo/meta_keywords'; + public const FAQ_META_DESCRIPTION = 'faqtab/seo/meta_description'; /** - * Is enable show group title + * Faq group icon image path */ - const CONFIG_PATH_IS_SHOW_GROUP_TITLE = 'faqtab/design/showgrouptitle'; + public const ICON_TMP_PATH = 'faq/tmp/icon/'; /** - * Faq page type config path + * Faq page render types */ - const CONFIG_PATH_PAGE_TYPE = 'faqtab/design/page_type'; + public const FAQ_PAGE_TYPE_AJAX = 'ajax'; + public const FAQ_PAGE_TYPE_SCROLL = 'scroll'; /** - * Faq url config path + * Ajax url for faq */ - const FAQ_URL_CONFIG_PATH = 'faqtab/seo/faq_url'; + public const FAQ_PAGE_AJAX_URL = 'faq/index/ajax'; /** - * Is faqs collapse expand enabled config path + * FAQ template files */ - const CONFIG_PATH_IS_ENABLED_COLLAPSE_EXPAND = 'faqtab/design/is_collapse_expand'; + public const FAQ_MAIN_TEMPLATE_FILE = 'Mageprince_Faq::faq_main.phtml'; + public const FAQ_AJAX_TEMPLATE_FILE = 'Mageprince_Faq::faq_ajax.phtml'; } diff --git a/Model/Config/Source/PageType.php b/Model/Config/Source/PageType.php index 16d9452..5a56a63 100755 --- a/Model/Config/Source/PageType.php +++ b/Model/Config/Source/PageType.php @@ -1,24 +1,31 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model\Config\Source; use Magento\Framework\Data\OptionSourceInterface; +use Mageprince\Faq\Model\Config\DefaultConfig; class PageType implements OptionSourceInterface { - const SCROLL = 'scroll'; - const AJAX = 'ajax'; - /** * Get page type * @@ -26,9 +33,12 @@ class PageType implements OptionSourceInterface */ public function toOptionArray() { - return [ - ['value' => self::SCROLL, 'label' => 'Scroll'], - ['value' => self::AJAX, 'label' => 'Ajax'] - ]; + return [[ + 'value' => DefaultConfig::FAQ_PAGE_TYPE_SCROLL, + 'label' => 'Scroll' + ], [ + 'value' => DefaultConfig::FAQ_PAGE_TYPE_AJAX, + 'label' => 'Ajax' + ]]; } } diff --git a/Model/Faq.php b/Model/Faq.php index aa11b23..88efc0c 100755 --- a/Model/Faq.php +++ b/Model/Faq.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model; diff --git a/Model/Faq/DataProvider.php b/Model/Faq/DataProvider.php index 8306d93..f719c1f 100755 --- a/Model/Faq/DataProvider.php +++ b/Model/Faq/DataProvider.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model\Faq; @@ -18,7 +27,9 @@ class DataProvider extends AbstractDataProvider { - + /** + * @var array + */ private $loadedData; /** @@ -29,12 +40,10 @@ class DataProvider extends AbstractDataProvider /** * @var CollectionFactory */ - public $collection; /** * DataProvider constructor. - * * @param string $name * @param string $primaryFieldName * @param string $requestFieldName @@ -72,14 +81,14 @@ public function getData() $this->loadedData[$model->getId()] = $model->getData(); } $data = $this->dataPersistor->get('mageprince_faq_faq'); - + if (!empty($data)) { $model = $this->collection->getNewEmptyItem(); $model->setData($data); $this->loadedData[$model->getId()] = $model->getData(); $this->dataPersistor->clear('mageprince_faq_faq'); } - + return $this->loadedData; } } diff --git a/Model/FaqGroup.php b/Model/FaqGroup.php index e980c82..e743d19 100755 --- a/Model/FaqGroup.php +++ b/Model/FaqGroup.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model; diff --git a/Model/FaqGroup/DataProvider.php b/Model/FaqGroup/DataProvider.php index 230eb56..441aca0 100755 --- a/Model/FaqGroup/DataProvider.php +++ b/Model/FaqGroup/DataProvider.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model\FaqGroup; @@ -20,6 +29,9 @@ class DataProvider extends AbstractDataProvider { + /** + * @var array + */ private $loadedData; /** diff --git a/Model/FaqGroupRepository.php b/Model/FaqGroupRepository.php index c9b487f..16c79d9 100755 --- a/Model/FaqGroupRepository.php +++ b/Model/FaqGroupRepository.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model; diff --git a/Model/FaqRepository.php b/Model/FaqRepository.php index 7afb194..e42d5cb 100755 --- a/Model/FaqRepository.php +++ b/Model/FaqRepository.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model; diff --git a/Model/ImageUploader.php b/Model/ImageUploader.php index f883e69..5df4851 100755 --- a/Model/ImageUploader.php +++ b/Model/ImageUploader.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model; @@ -27,29 +36,21 @@ class ImageUploader { /** - * Core file storage database - * * @var Database */ private $coreFileStorageDatabase; /** - * Media directory object (writable). - * * @var WriteInterface */ private $mediaDirectory; /** - * Uploader factory - * * @var UploaderFactory */ private $uploaderFactory; /** - * Store manager - * * @var StoreManagerInterface */ private $storeManager; @@ -60,22 +61,16 @@ class ImageUploader private $logger; /** - * Base tmp path - * * @var string */ public $baseTmpPath; /** - * Base path - * * @var string */ public $basePath; /** - * Allowed extensions - * * @var string */ public $allowedExtensions; diff --git a/Model/ResourceModel/Faq.php b/Model/ResourceModel/Faq.php index fe02f6e..704651b 100755 --- a/Model/ResourceModel/Faq.php +++ b/Model/ResourceModel/Faq.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model\ResourceModel; diff --git a/Model/ResourceModel/Faq/Collection.php b/Model/ResourceModel/Faq/Collection.php index 65cacfd..85e266e 100755 --- a/Model/ResourceModel/Faq/Collection.php +++ b/Model/ResourceModel/Faq/Collection.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model\ResourceModel\Faq; @@ -18,8 +27,11 @@ class Collection extends AbstractCollection { + /** + * @var string + */ public $_idFieldName = 'faq_id'; - + /** * Define resource model * diff --git a/Model/ResourceModel/FaqGroup.php b/Model/ResourceModel/FaqGroup.php index bac2cb1..563e046 100755 --- a/Model/ResourceModel/FaqGroup.php +++ b/Model/ResourceModel/FaqGroup.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model\ResourceModel; diff --git a/Model/ResourceModel/FaqGroup/Collection.php b/Model/ResourceModel/FaqGroup/Collection.php index b0b5e40..aebab8f 100755 --- a/Model/ResourceModel/FaqGroup/Collection.php +++ b/Model/ResourceModel/FaqGroup/Collection.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Model\ResourceModel\FaqGroup; @@ -18,8 +27,11 @@ class Collection extends AbstractCollection { + /** + * @var string + */ public $_idFieldName = 'faqgroup_id'; - + /** * Define resource model * diff --git a/Observer/ConfigChange.php b/Observer/ConfigChange.php index 39da80d..d348423 100755 --- a/Observer/ConfigChange.php +++ b/Observer/ConfigChange.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Observer; @@ -21,7 +30,7 @@ class ConfigChange implements ObserverInterface { - const REQUEST_PATH = 'faq'; + private const REQUEST_PATH = 'faq'; /** * @var RequestInterface @@ -43,6 +52,11 @@ class ConfigChange implements ObserverInterface */ protected $storeManager; + /** + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + /** * ConfigChange constructor. * @@ -50,47 +64,60 @@ class ConfigChange implements ObserverInterface * @param WriterInterface $configWriter * @param UrlRewriteFactory $urlRewriteFactory * @param StoreManagerInterface $storeManager + * @param \Psr\Log\LoggerInterface $logger */ public function __construct( RequestInterface $request, WriterInterface $configWriter, UrlRewriteFactory $urlRewriteFactory, - StoreManagerInterface $storeManager + StoreManagerInterface $storeManager, + \Psr\Log\LoggerInterface $logger ) { $this->request = $request; $this->configWriter = $configWriter; $this->urlRewriteFactory = $urlRewriteFactory; $this->storeManager = $storeManager; + $this->logger = $logger; } + /** + * Save FAQ url + * + * @param EventObserver $observer + * @return $this|void + */ public function execute(EventObserver $observer) { - $faqParams = $this->request->getParam('groups'); - if (!empty($faqParams['seo']['fields']['faq_url'])) { - $faqUrlVal = $faqParams['seo']['fields']['faq_url']; - $urlKey = str_replace(' ', '-', $faqUrlVal['value']); - $filterUrlKey = preg_replace('/[^A-Za-z0-9\-]/', '', $urlKey); - $this->configWriter->save('faqtab/seo/faq_url', $filterUrlKey); - $stores = $this->storeManager->getStores(); - foreach ($stores as $store) { - $urlRewriteModel = $this->urlRewriteFactory->create(); - $rewriteCollection = $urlRewriteModel->getCollection() - ->addFieldToFilter('request_path', self::REQUEST_PATH) - ->addFieldToFilter('store_id', $store->getId()) - ->getFirstItem(); - $urlRewriteModel->load($rewriteCollection->getId()); - if ($filterUrlKey == self::REQUEST_PATH) { - if ($urlRewriteModel->getId()) { - $urlRewriteModel->delete(); + try { + $faqParams = $this->request->getParam('groups'); + if (!empty($faqParams['seo']['fields']['faq_url'])) { + $faqUrlVal = $faqParams['seo']['fields']['faq_url']; + $urlKey = str_replace(' ', '-', $faqUrlVal['value']); + $filterUrlKey = preg_replace('/[^A-Za-z0-9\-]/', '', $urlKey); + $this->configWriter->save('faqtab/seo/faq_url', $filterUrlKey); + $stores = $this->storeManager->getStores(); + foreach ($stores as $store) { + $urlRewriteModel = $this->urlRewriteFactory->create(); + $rewriteCollection = $urlRewriteModel->getCollection() + ->addFieldToFilter('request_path', self::REQUEST_PATH) + ->addFieldToFilter('store_id', $store->getId()) + ->getFirstItem(); + $urlRewriteModel->load($rewriteCollection->getId()); + if ($filterUrlKey == self::REQUEST_PATH) { + if ($urlRewriteModel->getId()) { + $urlRewriteModel->delete(); + } + } else { + $urlRewriteModel->setStoreId($store->getId()); + $urlRewriteModel->setTargetPath($filterUrlKey); + $urlRewriteModel->setRequestPath(self::REQUEST_PATH); + $urlRewriteModel->setredirectType(301); + $urlRewriteModel->save(); } - } else { - $urlRewriteModel->setStoreId($store->getId()); - $urlRewriteModel->setTargetPath($filterUrlKey); - $urlRewriteModel->setRequestPath(self::REQUEST_PATH); - $urlRewriteModel->setredirectType(301); - $urlRewriteModel->save(); } } + } catch (\Exception $e) { + $this->logger->error('FAQ url save error:' . $e->getMessage()); } return $this; } diff --git a/Plugin/Magento/Backend/Model/Menu/Item.php b/Plugin/Magento/Backend/Model/Menu/Item.php deleted file mode 100755 index a90cccb..0000000 --- a/Plugin/Magento/Backend/Model/Menu/Item.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince - */ - -namespace Mageprince\Faq\Plugin\Magento\Backend\Model\Menu; - -class Item -{ - /** - * @param $subject - * @param $result - * @return string - */ - public function afterGetUrl($subject, $result) - { - $menuId = $subject->getId(); - - if ($menuId == 'Mageprince_Faq::faq_user_guid') { - $result = 'https://marketplace.magento.com/media/catalog/product/prince-module-faq-2-0-10-ce/user_guides.pdf'; - } - - return $result; - } -} diff --git a/README.md b/README.md deleted file mode 100755 index 85bb05b..0000000 --- a/README.md +++ /dev/null @@ -1,76 +0,0 @@ -[![Latest Stable Version](https://poser.pugx.org/mageprince/module-faq/v)](//packagist.org/packages/mageprince/module-faq) -[![Total Downloads](https://poser.pugx.org/mageprince/module-faq/downloads)](//packagist.org/packages/mageprince/module-faq) -[![Monthly Downloads](https://poser.pugx.org/mageprince/module-faq/d/monthly)](//packagist.org/packages/mageprince/module-faq) -[![License](https://poser.pugx.org/mageprince/module-faq/license)](//packagist.org/packages/mageprince/module-faq) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mageprince/magento2-FAQ/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mageprince/magento2-FAQ/?branch=master) -[![Code Intelligence Status](https://scrutinizer-ci.com/g/mageprince/magento2-FAQ/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence) - - -# Magento 2 FAQ - -This module adds an easy way to use FAQ section to your Magento store with jQuery Accordion. In this module, admin can add and update FAQ. Admin can also create FAQ group with group icon. Admin can add widgets, blocks, images etc. in FAQ answer with wyswing editor. - - -# New Features - -- Show all FAQ on CMS page and static block -- Show FAQ by group on CMS page and static block -- Load FAQ by ajax on group selection on the frontend -- Custom FAQ URL -- Add FAQ anywhere by widget - -Check full description and user guid on Magento Marketplace - -# Demo - -Frontend | Backend - -# How to install Magento 2 FAQ - -### 1. Install from Magento Marketplace - - [Magento Marketplace Link](https://commercemarketplace.adobe.com/mageprince-module-faq.html) - -### 2. Install via composer (packagist.org) - -Run the following command in the Magento 2 root folder: - - composer require mageprince/module-faq - php bin/magento setup:upgrade - php bin/magento setup:di:compile - php bin/magento setup:static-content:deploy - -# Use the below code for the CMS page and Static Block - -1. To show all FAQ - -{{block class="Mageprince\Faq\Block\Index\Index" template="Mageprince_Faq::faq_main.phtml" show_group_title=1 show_group=1 page_type="scroll"}} - -2. To show FAQ by group - -{{block class="Mageprince\Faq\Block\Index\Index" template="Mageprince_Faq::faq_main.phtml" group_id=1 show_group_title=1}} - - -# Contribution - -Want to contribute to this extension? The quickest way is to open a pull request on GitHub. - -# Support - -If you encounter any problems or bugs, please open an issue on GitHub. - - -# Extension Screenshots - - - - - - - - - - - - - diff --git a/Setup/InstallData.php b/Setup/InstallData.php deleted file mode 100755 index ef7c960..0000000 --- a/Setup/InstallData.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince - */ - -namespace Mageprince\Faq\Setup; - -use Magento\Framework\Setup\InstallDataInterface; -use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataSetupInterface; - -class InstallData implements InstallDataInterface -{ - /** - * Add faq sample data - * - * @param ModuleDataSetupInterface $setup - * @param ModuleContextInterface $context - */ - public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) - { - $faqGroupData = [ - 'groupname' => 'General', - 'sortorder' => '1', - 'storeview' => '1', - 'customer_group' => '0,1,2,3,4', - 'status' => '1' - ]; - - $faqData = [ - 'title' => 'This is a test FAQ question', - 'content' => 'This is a test FAQ answer', - 'group' => '1', - 'storeview' => '1', - 'customer_group' => '0,1,2,3,4', - 'sortorder' => '0', - 'status' => '1' - ]; - - $faqGroupTable = $setup->getTable('prince_faqgroup'); - $faqTable = $setup->getTable('prince_faq'); - - $setup->getConnection()->insert($faqGroupTable, $faqGroupData); - $setup->getConnection()->insert($faqTable, $faqData); - } -} diff --git a/Setup/InstallSchema.php b/Setup/InstallSchema.php deleted file mode 100755 index 8fbe037..0000000 --- a/Setup/InstallSchema.php +++ /dev/null @@ -1,169 +0,0 @@ - - * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince - */ - -namespace Mageprince\Faq\Setup; - -use Magento\Framework\Setup\InstallSchemaInterface; -use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaSetupInterface; - -class InstallSchema implements InstallSchemaInterface -{ - /** - * {@inheritdoc} - */ - public function install( - SchemaSetupInterface $setup, - ModuleContextInterface $context - ) { - $installer = $setup; - $installer->startSetup(); - - $table_prince_faqgroup = $setup->getConnection()->newTable($setup->getTable('prince_faqgroup')); - - $table_prince_faqgroup->addColumn( - 'faqgroup_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [ - 'identity' => true, - 'nullable' => false, - 'primary' => true, - 'unsigned' => true, - ], - 'Entity ID' - ); - - $table_prince_faqgroup->addColumn( - 'groupname', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'groupname' - ); - - $table_prince_faqgroup->addColumn( - 'icon', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'icon' - ); - - $table_prince_faqgroup->addColumn( - 'storeview', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'storeview' - ); - - $table_prince_faqgroup->addColumn( - 'customer_group', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'customer_group' - ); - - $table_prince_faqgroup->addColumn( - 'sortorder', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'sortorder' - ); - - $table_prince_faqgroup->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - null, - [], - 'status' - ); - - $table_prince_faq = $setup->getConnection()->newTable($setup->getTable('prince_faq')); - - $table_prince_faq->addColumn( - 'faq_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [ - 'identity' => true, - 'nullable' => false, - 'primary' => true, - 'unsigned' => true, - ], - 'Entity ID' - ); - - $table_prince_faq->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'title' - ); - - $table_prince_faq->addColumn( - 'content', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'content' - ); - - $table_prince_faq->addColumn( - 'group', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'group' - ); - - $table_prince_faq->addColumn( - 'storeview', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'storeview' - ); - - $table_prince_faq->addColumn( - 'customer_group', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'customer_group' - ); - - $table_prince_faq->addColumn( - 'sortorder', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'sortorder' - ); - - $table_prince_faq->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - null, - [], - 'status' - ); - - $setup->getConnection()->createTable($table_prince_faq); - $setup->getConnection()->createTable($table_prince_faqgroup); - $setup->endSetup(); - } -} diff --git a/Setup/Patch/Data/SampleFaqData.php b/Setup/Patch/Data/SampleFaqData.php new file mode 100644 index 0000000..45d869f --- /dev/null +++ b/Setup/Patch/Data/SampleFaqData.php @@ -0,0 +1,75 @@ +moduleDataSetup = $moduleDataSetup; + } + + /** + * @inheritdoc + */ + public function apply() + { + $this->moduleDataSetup->getConnection()->startSetup(); + $setup = $this->moduleDataSetup; + + $faqGroupData = [ + 'groupname' => 'General', + 'sortorder' => '1', + 'storeview' => '1', + 'customer_group' => '0,1,2,3,4', + 'status' => '1' + ]; + + $faqData = [ + 'title' => 'This is a test FAQ question', + 'content' => 'This is a test FAQ answer', + 'group' => '1', + 'storeview' => '1', + 'customer_group' => '0,1,2,3,4', + 'sortorder' => '0', + 'status' => '1' + ]; + + $faqGroupTable = $setup->getTable('prince_faqgroup'); + $faqTable = $setup->getTable('prince_faq'); + + $setup->getConnection()->insert($faqGroupTable, $faqGroupData); + $setup->getConnection()->insert($faqTable, $faqData); + $this->moduleDataSetup->getConnection()->endSetup(); + } + + /** + * @inheritdoc + */ + public static function getDependencies() + { + return []; + } + + /** + * @inheritdoc + */ + public function getAliases() + { + return []; + } +} diff --git a/Setup/UpgradeSchema.php b/Setup/UpgradeSchema.php deleted file mode 100644 index f8b8490..0000000 --- a/Setup/UpgradeSchema.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince - */ - -namespace Mageprince\Faq\Setup; - -use Magento\Framework\DB\Ddl\Table as DdlTable; -use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaSetupInterface; -use Magento\Framework\Setup\UpgradeSchemaInterface; - -class UpgradeSchema implements UpgradeSchemaInterface -{ - /** - * {@inheritdoc} - */ - public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) - { - if (version_compare($context->getVersion(), '2.0.7', '<')) { - $this->addDateColumns($setup); - } - } - - /** - * Add date columns - * - * @param SchemaSetupInterface $setup - */ - public function addDateColumns($setup) - { - $installer = $setup; - $installer->startSetup(); - - $faqTable = $setup->getTable('prince_faq'); - - if ($setup->getConnection()->isTableExists($faqTable)) { - $installer->getConnection() - ->addColumn( - $faqTable, - 'created_at', - [ - 'type' => DdlTable::TYPE_TIMESTAMP, - 'nullable' => false, - 'default' => DdlTable::TIMESTAMP_INIT, - 'comment' => 'Faq Created Date Time' - ] - ); - $installer->getConnection() - ->addColumn( - $faqTable, - 'updated_at', - [ - 'type' => DdlTable::TYPE_TIMESTAMP, - 'nullable' => false, - 'default' => DdlTable::TIMESTAMP_INIT_UPDATE, - 'comment' => 'Faq Modified Date Time' - ] - ); - } - - $faqGroupTable = $setup->getTable('prince_faqgroup'); - - if ($setup->getConnection()->isTableExists($faqGroupTable)) { - $installer->getConnection() - ->addColumn( - $faqGroupTable, - 'created_at', - [ - 'type' => DdlTable::TYPE_TIMESTAMP, - 'nullable' => false, - 'default' => DdlTable::TIMESTAMP_INIT, - 'comment' => 'Faq Group Created Date Time' - ] - ); - $installer->getConnection()->addColumn( - $faqGroupTable, - 'updated_at', - [ - 'type' => DdlTable::TYPE_TIMESTAMP, - 'nullable' => false, - 'default' => DdlTable::TIMESTAMP_INIT_UPDATE, - 'comment' => 'Faq Group Modified Date Time' - ] - ); - } - } -} diff --git a/Ui/Component/Listing/Column/FaqActions.php b/Ui/Component/Listing/Column/FaqActions.php index 09cd143..134718e 100755 --- a/Ui/Component/Listing/Column/FaqActions.php +++ b/Ui/Component/Listing/Column/FaqActions.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Ui\Component\Listing\Column; @@ -22,15 +31,15 @@ class FaqActions extends Column /** * @var UrlInterface */ - private $urlBuilder; + protected $urlBuilder; - const URL_PATH_EDIT = 'mageprince_faq/faq/edit'; - - const URL_PATH_DELETE = 'mageprince_faq/faq/delete'; + /** + * Faq delete url path + */ + private const URL_PATH_EDIT = 'mageprince_faq/faq/edit'; /** * FaqActions constructor. - * * @param ContextInterface $context * @param UiComponentFactory $uiComponentFactory * @param UrlInterface $urlBuilder diff --git a/Ui/Component/Listing/Column/FaqGroup.php b/Ui/Component/Listing/Column/FaqGroup.php index 81d8c41..2b4ea0c 100755 --- a/Ui/Component/Listing/Column/FaqGroup.php +++ b/Ui/Component/Listing/Column/FaqGroup.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Ui\Component\Listing\Column; @@ -20,11 +29,10 @@ class FaqGroup implements OptionSourceInterface /** * @var CollectionFactory */ - private $groupCollection; + protected $groupCollection; /** * FaqGroup constructor. - * * @param CollectionFactory $groupCollection */ public function __construct( diff --git a/Ui/Component/Listing/Column/FaqGroupActions.php b/Ui/Component/Listing/Column/FaqGroupActions.php index 2cd4bbc..ae1e0af 100755 --- a/Ui/Component/Listing/Column/FaqGroupActions.php +++ b/Ui/Component/Listing/Column/FaqGroupActions.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Ui\Component\Listing\Column; @@ -24,13 +33,13 @@ class FaqGroupActions extends Column */ private $urlBuilder; - const URL_PATH_EDIT = 'mageprince_faq/faqgroup/edit'; - - const URL_PATH_DELETE = 'mageprince_faq/faqgroup/delete'; + /** + * Faq group edit url path + */ + private const URL_PATH_EDIT = 'mageprince_faq/faqgroup/edit'; /** * FaqGroupActions constructor. - * * @param ContextInterface $context * @param UiComponentFactory $uiComponentFactory * @param UrlInterface $urlBuilder diff --git a/Ui/Component/Listing/Column/FaqIds.php b/Ui/Component/Listing/Column/FaqIds.php index 162801e..e429a8c 100755 --- a/Ui/Component/Listing/Column/FaqIds.php +++ b/Ui/Component/Listing/Column/FaqIds.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Ui\Component\Listing\Column; @@ -20,11 +29,10 @@ class FaqIds implements OptionSourceInterface /** * @var CollectionFactory */ - private $faqCollection; + protected $faqCollection; /** * FaqIds constructor. - * * @param CollectionFactory $faqCollection */ public function __construct( diff --git a/Ui/Component/Listing/Column/GroupIcon.php b/Ui/Component/Listing/Column/GroupIcon.php index dee0b37..2f08502 100755 --- a/Ui/Component/Listing/Column/GroupIcon.php +++ b/Ui/Component/Listing/Column/GroupIcon.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Ui\Component\Listing\Column; @@ -22,21 +31,23 @@ class GroupIcon extends Column { - private $storeManager; + /** + * @var StoreManagerInterface + */ + protected $storeManager; /** * @var Repository */ - private $assetRepo; + protected $assetRepo; /** * @var UrlInterface */ - private $_backendUrl; + protected $_backendUrl; /** * GroupIcon constructor. - * * @param ContextInterface $context * @param UiComponentFactory $uiComponentFactory * @param StoreManagerInterface $storeManager diff --git a/Ui/Component/Listing/Column/Status.php b/Ui/Component/Listing/Column/Status.php index 1873960..544cbb7 100755 --- a/Ui/Component/Listing/Column/Status.php +++ b/Ui/Component/Listing/Column/Status.php @@ -1,13 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ namespace Mageprince\Faq\Ui\Component\Listing\Column; @@ -23,6 +32,9 @@ class Status implements OptionSourceInterface */ public function toOptionArray() { - return [['value' => 1, 'label' => __('Enable')], ['value' => 0, 'label' => __('Disable')]]; + return [ + ['value' => 1, 'label' => __('Enable')], + ['value' => 0, 'label' => __('Disable')] + ]; } } diff --git a/composer.json b/composer.json index b169d3e..9b83918 100755 --- a/composer.json +++ b/composer.json @@ -1,19 +1,9 @@ { "name": "mageprince/module-faq", "description": "Magento2 FAQ Module", - "homepage": "https://github.com/mageprince/magento2-FAQ", "type": "magento2-module", - "version": "2.0.10", + "version": "2.1.4", "license": "GPL-3.0-or-later", - "authors": [ - { - "name": "Mageprince", - "email": "contact@mageprince.com" - } - ], - "support": { - "issues": "https://github.com/mageprince/magento2-FAQ/issues" - }, "autoload": { "files": [ "registration.php" diff --git a/etc/acl.xml b/etc/acl.xml index 9c919cb..bf38b0d 100755 --- a/etc/acl.xml +++ b/etc/acl.xml @@ -2,14 +2,24 @@ + --> diff --git a/etc/adminhtml/di.xml b/etc/adminhtml/di.xml deleted file mode 100755 index 3a790c8..0000000 --- a/etc/adminhtml/di.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/etc/adminhtml/events.xml b/etc/adminhtml/events.xml index bfc4084..b271177 100755 --- a/etc/adminhtml/events.xml +++ b/etc/adminhtml/events.xml @@ -2,16 +2,26 @@ + --> - \ No newline at end of file + diff --git a/etc/adminhtml/menu.xml b/etc/adminhtml/menu.xml index d0282d4..04578a9 100755 --- a/etc/adminhtml/menu.xml +++ b/etc/adminhtml/menu.xml @@ -2,22 +2,33 @@ + --> - + + title="Manage FAQ Group"/> - - - diff --git a/etc/adminhtml/routes.xml b/etc/adminhtml/routes.xml index 01b9b13..fc228c6 100755 --- a/etc/adminhtml/routes.xml +++ b/etc/adminhtml/routes.xml @@ -2,14 +2,24 @@ + --> diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index e991205..1618f27 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -2,18 +2,28 @@ + --> - +
separator-top diff --git a/etc/config.xml b/etc/config.xml index 7595526..0afd567 100755 --- a/etc/config.xml +++ b/etc/config.xml @@ -2,14 +2,24 @@ + --> diff --git a/etc/db_schema.xml b/etc/db_schema.xml new file mode 100644 index 0000000..ebcb3c9 --- /dev/null +++ b/etc/db_schema.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
diff --git a/etc/di.xml b/etc/di.xml index 25d1b93..45b6dc8 100755 --- a/etc/di.xml +++ b/etc/di.xml @@ -2,14 +2,24 @@ + --> diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index c36aa1b..045d9fd 100755 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -2,14 +2,24 @@ + --> diff --git a/etc/frontend/routes.xml b/etc/frontend/routes.xml index 9cf6126..21dbaba 100755 --- a/etc/frontend/routes.xml +++ b/etc/frontend/routes.xml @@ -2,14 +2,24 @@ + --> diff --git a/etc/module.xml b/etc/module.xml index 847ae74..af38345 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -2,16 +2,26 @@ + --> - + diff --git a/i18n/en_US.csv b/i18n/en_US.csv new file mode 100644 index 0000000..30a72f0 --- /dev/null +++ b/i18n/en_US.csv @@ -0,0 +1,76 @@ +"Delete FAQ","Delete FAQ" +"Are you sure you want to do this?","Are you sure you want to do this?" +"Save and Continue Edit","Save and Continue Edit" +"Save FAQ","Save FAQ" +"Delete FAQ group","Delete FAQ group" +"Save FAQ Group","Save FAQ Group" +"You deleted the Faq.","You deleted the Faq." +"We can't find a Faq to delete.","We can't find a Faq to delete." +"This FAQ no longer exists.","This FAQ no longer exists." +"New FAQ","New FAQ" +"FAQ","FAQ" +"Please correct the data sent.","Please correct the data sent." +"A total of %1 FAQ(s) were deleted.","A total of %1 FAQ(s) were deleted." +"You saved the FAQ.","You saved the FAQ." +"Something went wrong while saving the FAQ.","Something went wrong while saving the FAQ." +"You deleted the Faq Group.","You deleted the Faq Group." +"We can't find a Faq Group to delete.","We can't find a Faq Group to delete." +"This Faq Group no longer exists.","This Faq Group no longer exists." +"New Faq Group","New Faq Group" +"FAQ Group","FAQ Group" +"A total of %1 FAQ Group(s) were deleted.","A total of %1 FAQ Group(s) were deleted." +"This FAQ Group no longer exists.","This FAQ Group no longer exists." +"You saved the FAQ Group.","You saved the FAQ Group." +"Something went wrong while saving the Faqgroup.","Something went wrong while saving the Faqgroup." +"Could not save the faqGroup: %1","Could not save the faqGroup: %1" +"FaqGroup with id ""%1"" does not exist.","FaqGroup with id ""%1"" does not exist." +"Could not delete the FaqGroup: %1","Could not delete the FaqGroup: %1" +"Could not save the faq: %1","Could not save the faq: %1" +"Faq with id ""%1"" does not exist.","Faq with id ""%1"" does not exist." +"Could not delete the Faq: %1","Could not delete the Faq: %1" +"Something went wrong while saving the file(s).","Something went wrong while saving the file(s)." +"File can not be saved to the destination folder.","File can not be saved to the destination folder." +"Collapse All","Collapse All" +"Expand All","Expand All" +"No FAQ Group available","No FAQ Group available" +"Delete image","Delete image" +"Mageprince FAQ","Mageprince FAQ" +"Manage FAQ Group","Manage FAQ Group" +"Manage FAQ","Manage FAQ" +"Mageprince Extensions","Mageprince Extensions" +"General Configuration","General Configuration" +"Module Enable","Module Enable" +"Page Style","Page Style" +"Show Group Icon","Show Group Icon" +"Show Group Title","Show Group Title" +"Show Footer Link","Show Footer Link" +"Show Header Link","Show Header Link" +"Enable Collapse All Expand All","Enable Collapse All Expand All" +"Search Engine Optimization","Search Engine Optimization" +"FAQ Url","FAQ Url" +"Meta Title","Meta Title" +"Meta Keywords","Meta Keywords" +"Meta Description","Meta Description" +"Code for CMS Page and Static block","Code for CMS Page and Static block" +"Select Faq Group","Select Faq Group" +"Show group","Show group" +"Page Type","Page Type" +"Show group title","Show group title" +"General Information","General Information" +"Title","Title" +"Content","Content" +"Group","Group" +"Store View","Store View" +"Customer Group","Customer Group" +"Sort Order","Sort Order" +"Add New FAQ","Add New FAQ" +"Delete Faq(s)","Delete Faq(s)" +"Are you sure you wan't to delete selected Faq(s)?","Are you sure you wan't to delete selected Faq(s)?" +"Created At","Created At" +"Modified At","Modified At" +"Group Name","Group Name" +"Group Image/Icon","Group Image/Icon" +"Add New FAQ Group","Add New FAQ Group" +"Delete Faq Group(s)","Delete Faq Group(s)" +"Are you sure you wan't to delete selected FaqGroup(s)?","Are you sure you wan't to delete selected FaqGroup(s)?" +"Icon","Icon" diff --git a/view/adminhtml/layout/mageprince_faq_faq_edit.xml b/view/adminhtml/layout/mageprince_faq_faq_edit.xml index fdbd36d..b1abda1 100755 --- a/view/adminhtml/layout/mageprince_faq_faq_edit.xml +++ b/view/adminhtml/layout/mageprince_faq_faq_edit.xml @@ -2,14 +2,24 @@ + --> diff --git a/view/adminhtml/layout/mageprince_faq_faq_index.xml b/view/adminhtml/layout/mageprince_faq_faq_index.xml index e68cd81..5113d02 100755 --- a/view/adminhtml/layout/mageprince_faq_faq_index.xml +++ b/view/adminhtml/layout/mageprince_faq_faq_index.xml @@ -2,14 +2,24 @@ + --> diff --git a/view/adminhtml/layout/mageprince_faq_faq_new.xml b/view/adminhtml/layout/mageprince_faq_faq_new.xml index 413617d..2d1915c 100755 --- a/view/adminhtml/layout/mageprince_faq_faq_new.xml +++ b/view/adminhtml/layout/mageprince_faq_faq_new.xml @@ -2,14 +2,24 @@ + --> diff --git a/view/adminhtml/layout/mageprince_faq_faqgroup_edit.xml b/view/adminhtml/layout/mageprince_faq_faqgroup_edit.xml index a38cc87..de00563 100755 --- a/view/adminhtml/layout/mageprince_faq_faqgroup_edit.xml +++ b/view/adminhtml/layout/mageprince_faq_faqgroup_edit.xml @@ -2,14 +2,24 @@ + --> diff --git a/view/adminhtml/layout/mageprince_faq_faqgroup_index.xml b/view/adminhtml/layout/mageprince_faq_faqgroup_index.xml index 5739c9f..0043306 100755 --- a/view/adminhtml/layout/mageprince_faq_faqgroup_index.xml +++ b/view/adminhtml/layout/mageprince_faq_faqgroup_index.xml @@ -2,14 +2,24 @@ + --> diff --git a/view/adminhtml/layout/mageprince_faq_faqgroup_new.xml b/view/adminhtml/layout/mageprince_faq_faqgroup_new.xml index 1dae646..5b916b9 100755 --- a/view/adminhtml/layout/mageprince_faq_faqgroup_new.xml +++ b/view/adminhtml/layout/mageprince_faq_faqgroup_new.xml @@ -2,14 +2,24 @@ + --> diff --git a/view/adminhtml/templates/system/config/Field/FaqBlockInfo.phtml b/view/adminhtml/templates/system/config/Field/FaqBlockInfo.phtml index a0f5246..a865559 100644 --- a/view/adminhtml/templates/system/config/Field/FaqBlockInfo.phtml +++ b/view/adminhtml/templates/system/config/Field/FaqBlockInfo.phtml @@ -56,7 +56,7 @@
  • 1.show_group_title: Show/Hide group title. Value must be 0 or 1
  • 2.show_group: Show/Hide group icon. Value must be 0 or 1
  • 3.page_type: Page type to show. Value must be “scroll” or “ajax”
  • -
  • 4.group_id: You can find group if from FAQ->Manage FAQGroups
  • +
  • 4.group_id: You can find group id from Admin > Content > Mageprince FAQ > Manage FAQ Group
  • diff --git a/view/adminhtml/ui_component/mageprince_faq_form.xml b/view/adminhtml/ui_component/mageprince_faq_form.xml index 7c25a84..086da9d 100755 --- a/view/adminhtml/ui_component/mageprince_faq_form.xml +++ b/view/adminhtml/ui_component/mageprince_faq_form.xml @@ -2,14 +2,24 @@ + -->
    diff --git a/view/adminhtml/ui_component/mageprince_faq_index.xml b/view/adminhtml/ui_component/mageprince_faq_index.xml index 3a413ab..2f6c63c 100755 --- a/view/adminhtml/ui_component/mageprince_faq_index.xml +++ b/view/adminhtml/ui_component/mageprince_faq_index.xml @@ -2,14 +2,24 @@ + --> diff --git a/view/adminhtml/ui_component/mageprince_faqgroup_form.xml b/view/adminhtml/ui_component/mageprince_faqgroup_form.xml index 8b652fa..92489d7 100755 --- a/view/adminhtml/ui_component/mageprince_faqgroup_form.xml +++ b/view/adminhtml/ui_component/mageprince_faqgroup_form.xml @@ -2,14 +2,24 @@ + --> diff --git a/view/adminhtml/ui_component/mageprince_faqgroup_index.xml b/view/adminhtml/ui_component/mageprince_faqgroup_index.xml index 203031c..5c0161f 100755 --- a/view/adminhtml/ui_component/mageprince_faqgroup_index.xml +++ b/view/adminhtml/ui_component/mageprince_faqgroup_index.xml @@ -2,14 +2,24 @@ + --> @@ -20,7 +30,7 @@ add - Add New FAQGroup + Add New FAQ Group primary */*/new @@ -60,10 +70,10 @@ delete - Delete FaqGroup(s) + Delete Faq Group(s) - Delete FaqGroup(s) + Delete Faq Group(s) Are you sure you wan't to delete selected FaqGroup(s)? diff --git a/view/adminhtml/web/template/image-preview.html b/view/adminhtml/web/template/image-preview.html index c5576de..718408a 100755 --- a/view/adminhtml/web/template/image-preview.html +++ b/view/adminhtml/web/template/image-preview.html @@ -17,13 +17,13 @@ data-role="delete-button" attr="title: $t('Delete image')" click="$parent.removeFile.bind($parent, $file)"> - + -
    +
    - x + x
    -
    \ No newline at end of file + diff --git a/view/frontend/layout/default.xml b/view/frontend/layout/default.xml index 027f864..385a750 100755 --- a/view/frontend/layout/default.xml +++ b/view/frontend/layout/default.xml @@ -2,14 +2,24 @@ + --> @@ -21,7 +31,7 @@ - + FAQ diff --git a/view/frontend/layout/faq_index_index.xml b/view/frontend/layout/faq_index_index.xml index 6afd963..c882dd8 100755 --- a/view/frontend/layout/faq_index_index.xml +++ b/view/frontend/layout/faq_index_index.xml @@ -2,14 +2,24 @@ + --> diff --git a/view/frontend/templates/faq_ajax.phtml b/view/frontend/templates/faq_ajax.phtml index 9ec9d7a..0044b26 100755 --- a/view/frontend/templates/faq_ajax.phtml +++ b/view/frontend/templates/faq_ajax.phtml @@ -1,12 +1,22 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement */ ?> getFaqCollection($block->getGroupId()); $group = $block->getGroupById($block->getGroupId()); ?> isShowGroupTitle()): ?> -
    - getGroupName(); ?> +
    + escapeHtml($group->getGroupName()); ?>
    getFaqCollection($group->getId()); ?> getSize()): ?> -

    getTitle(); ?>

    +

    escapeHtml($faq->getTitle()); ?>

    filterOutputHtml($faq->getContent()); ?>

    diff --git a/view/frontend/templates/faq_main.phtml b/view/frontend/templates/faq_main.phtml index eebda23..d1c09bf 100755 --- a/view/frontend/templates/faq_main.phtml +++ b/view/frontend/templates/faq_main.phtml @@ -1,31 +1,47 @@ * - * @package Mageprince_Faq - * @copyright Copyright (c) 2020 Mageprince (http://www.mageprince.com/) - * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License,version 3 (GPL-3.0) - * @author MagePrince + * NOTICE OF LICENSE + * + * This source file is subject to the mageprince.com license that is + * available through the world-wide-web at this URL: + * https://mageprince.com/end-user-license-agreement + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category MagePrince + * @package Mageprince_Faq + * @copyright Copyright (c) MagePrince (https://mageprince.com/) + * @license https://mageprince.com/end-user-license-agreement + */ +?> + - isEnable()): ?> getFaqGroupCollection(); ?> getSize()): ?> getPageTypeAction(); ?>
    - loader + <?= $block->escapeHtmlAttr(__('loader')); ?>