From 122ce24a3a545d516038cf091fe15567ef367324 Mon Sep 17 00:00:00 2001 From: Craig Newbury Date: Fri, 15 Jun 2018 18:41:55 +0200 Subject: [PATCH] Basic working module created. --- Block/FacebookChat.php | 56 ++++++++++++++++++++++ LICENSE | 21 ++++++++ composer.json | 30 ++++++++++++ etc/acl.xml | 18 +++++++ etc/adminhtml/system.xml | 26 ++++++++++ etc/config.xml | 10 ++++ etc/module.xml | 4 ++ registration.php | 6 +++ view/frontend/layout/default.xml | 12 +++++ view/frontend/templates/FacebookChat.phtml | 14 ++++++ 10 files changed, 197 insertions(+) create mode 100644 Block/FacebookChat.php create mode 100644 LICENSE create mode 100644 composer.json create mode 100644 etc/acl.xml create mode 100644 etc/adminhtml/system.xml create mode 100644 etc/config.xml create mode 100644 etc/module.xml create mode 100644 registration.php create mode 100644 view/frontend/layout/default.xml create mode 100644 view/frontend/templates/FacebookChat.phtml diff --git a/Block/FacebookChat.php b/Block/FacebookChat.php new file mode 100644 index 0000000..48a8a94 --- /dev/null +++ b/Block/FacebookChat.php @@ -0,0 +1,56 @@ +config = $config; + $this->localeResolver = $resolver; + } + + /** + * @return mixed + */ + public function getPageId() + { + return $this->config->getValue(self::CONFIG_PATH_PAGE_ID); + } + + /** + * @return string + */ + public function getLocale() + { + return $this->localeResolver->getLocale(); + } +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..92e7772 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Craig Newbury + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..6e3843e --- /dev/null +++ b/composer.json @@ -0,0 +1,30 @@ +{ + "name": "newbury/module-facebook-chat", + "description": "Magento 2 module allowing the easy installation of the Facebook customer chat plugin.", + "require": { + "php": "7.0.2|7.0.4|~7.0.6|~7.1.0" + }, + "type": "magento2-module", + "version": "1.0.0", + "license": [ + "MIT" + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Newbury\\FacebookChat\\": "" + } + }, + "authors": [ + { + "name": "Craig Newbury", + "email": "craig@newbury.me", + "role": "Developer" + } + ], + "support": { + "email": "support@newbury.me" + } +} diff --git a/etc/acl.xml b/etc/acl.xml new file mode 100644 index 0000000..8637a66 --- /dev/null +++ b/etc/acl.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml new file mode 100644 index 0000000..bc76590 --- /dev/null +++ b/etc/adminhtml/system.xml @@ -0,0 +1,26 @@ + + + + + + +
+ + newbury + Newbury_FacebookChat::config + + + + + Magento\Config\Model\Config\Source\Yesno + newbury/facebookchat/enabled + + + + + newbury/facebookchat/page_id + + +
+
+
\ No newline at end of file diff --git a/etc/config.xml b/etc/config.xml new file mode 100644 index 0000000..d73c794 --- /dev/null +++ b/etc/config.xml @@ -0,0 +1,10 @@ + + + + + + 0 + + + + diff --git a/etc/module.xml b/etc/module.xml new file mode 100644 index 0000000..38c555f --- /dev/null +++ b/etc/module.xml @@ -0,0 +1,4 @@ + + + + diff --git a/registration.php b/registration.php new file mode 100644 index 0000000..07c5662 --- /dev/null +++ b/registration.php @@ -0,0 +1,6 @@ + + + + + + + + diff --git a/view/frontend/templates/FacebookChat.phtml b/view/frontend/templates/FacebookChat.phtml new file mode 100644 index 0000000..ac1ed28 --- /dev/null +++ b/view/frontend/templates/FacebookChat.phtml @@ -0,0 +1,14 @@ + +getPageId())) return; ?> + +
+
\ No newline at end of file