From 5df58ccce6131aad514e46abda15538f4868d243 Mon Sep 17 00:00:00 2001 From: Nate Iler Date: Wed, 11 Jan 2023 14:23:12 -0700 Subject: [PATCH] changing handle wip --- CHANGELOG.md | 4 ++ composer.json | 2 +- src/HubSpot.php | 38 +++++++++---------- src/connections/ApplicationKeyConnection.php | 2 +- src/connections/PrivateKeyConnection.php | 2 +- .../controllers/view/AbstractController.php | 6 +-- src/fields/Objects.php | 18 ++++----- .../connections/applicationKey.twig | 8 ++-- .../connections/privateApplicationKey.twig | 8 ++-- .../_cp/_layout/_connectionOptions.twig | 2 +- src/templates/_cp/limits/index.twig | 8 ++-- src/templates/_cp/objects/payload.twig | 2 +- src/templates/_cp/settings/_layout.twig | 2 +- .../_cp/settings/connections/index.twig | 26 ++++++------- .../_cp/settings/connections/upsert.twig | 16 ++++---- src/templates/_cp/settings/general/index.twig | 16 ++++---- src/templates/_cp/visitors/detail.twig | 8 ++-- src/templates/_cp/visitors/index.twig | 18 ++++----- src/templates/_patron/providers/settings.twig | 2 +- 19 files changed, 96 insertions(+), 92 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7b2488..3149095 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased +### Changed +- Renamed plugin handle (and twig variables) from 'hubspot' to 'flipbox-hubspot' + ## 1.4.0 - 2022-09-28 ### Added - Connection using HubSpot Private App token diff --git a/composer.json b/composer.json index 3f98a0a..82a4f69 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ }, "extra": { "name": "HubSpot", - "handle": "hubspot", + "handle": "flipbox-hubspot", "class": "flipbox\\craft\\hubspot\\HubSpot", "developer": "Flipbox Digital", "developerUrl": "https://www.flipboxdigital.com", diff --git a/src/HubSpot.php b/src/HubSpot.php index 6e875c9..8dffc5f 100644 --- a/src/HubSpot.php +++ b/src/HubSpot.php @@ -46,7 +46,7 @@ class HubSpot extends Plugin /** * @var string */ - public static $category = 'hubspot'; + public static $category = 'flipbox-hubspot'; /** * @inheritdoc @@ -86,7 +86,7 @@ public function init() function (Event $event) { /** @var CraftVariable $variable */ $variable = $event->sender; - $variable->set('hubspot', HubSpotVariable::class); + $variable->set('flipbox-hubspot', HubSpotVariable::class); } ); @@ -133,17 +133,17 @@ public function getCpNavItem() parent::getCpNavItem(), [ 'subnav' => [ - 'hubspot.visitors' => [ + 'flipbox-hubspot.visitors' => [ 'label' => static::t('Visitors'), - 'url' => 'hubspot/visitors', + 'url' => 'flipbox-hubspot/visitors', ], - 'hubspot.limits' => [ + 'flipbox-hubspot.limits' => [ 'label' => static::t('Limits'), - 'url' => 'hubspot/limits', + 'url' => 'flipbox-hubspot/limits', ], - 'hubspot.settings' => [ + 'flipbox-hubspot.settings' => [ 'label' => static::t('Settings'), - 'url' => 'hubspot/settings', + 'url' => 'flipbox-hubspot/settings', ] ] ] @@ -165,7 +165,7 @@ public function createSettingsModel() public function settingsHtml() { Craft::$app->getResponse()->redirect( - UrlHelper::cpUrl('hubspot/settings') + UrlHelper::cpUrl('flipbox-hubspot/settings') ); Craft::$app->end(); @@ -236,7 +236,7 @@ public function getVisitor(): Visitor */ public static function t($message, $params = [], $language = null) { - return Craft::t('hubspot', $message, $params, $language); + return Craft::t('flipbox-hubspot', $message, $params, $language); } @@ -269,25 +269,25 @@ public static function onRegisterCpUrlRules(RegisterUrlRulesEvent $event) $event->rules, [ // ?? - 'hubspot' => 'hubspot/cp/settings/view/general/index', + 'flipbox-hubspot' => 'flipbox-hubspot/cp/settings/view/general/index', // LIMITS - 'hubspot/limits' => 'hubspot/cp/view/limits/index', + 'flipbox-hubspot/limits' => 'flipbox-hubspot/cp/view/limits/index', // VISITORS - 'hubspot/visitors' => 'hubspot/cp/view/visitors/index', - 'hubspot/visitors/' => 'hubspot/cp/view/visitors/detail', + 'flipbox-hubspot/visitors' => 'flipbox-hubspot/cp/view/visitors/index', + 'flipbox-hubspot/visitors/' => 'flipbox-hubspot/cp/view/visitors/detail', // OBJECTS: PAYLOAD - 'hubspot/objects/payloads//element/' => 'hubspot/cp/view/object-payloads/index', + 'flipbox-hubspot/objects/payloads//element/' => 'flipbox-hubspot/cp/view/object-payloads/index', // SETTINGS - 'hubspot/settings' => 'hubspot/cp/settings/view/general/index', + 'flipbox-hubspot/settings' => 'flipbox-hubspot/cp/settings/view/general/index', // SETTINGS: CONNECTIONS - 'hubspot/settings/connections' => 'hubspot/cp/settings/view/connections/index', - 'hubspot/settings/connections/new' => 'hubspot/cp/settings/view/connections/upsert', - 'hubspot/settings/connections/' => 'hubspot/cp/settings/view/connections/upsert', + 'flipbox-hubspot/settings/connections' => 'flipbox-hubspot/cp/settings/view/connections/index', + 'flipbox-hubspot/settings/connections/new' => 'flipbox-hubspot/cp/settings/view/connections/upsert', + 'flipbox-hubspot/settings/connections/' => 'flipbox-hubspot/cp/settings/view/connections/upsert', ] ); diff --git a/src/connections/ApplicationKeyConnection.php b/src/connections/ApplicationKeyConnection.php index d481ded..0d1cc98 100644 --- a/src/connections/ApplicationKeyConnection.php +++ b/src/connections/ApplicationKeyConnection.php @@ -49,7 +49,7 @@ public static function displayName(): string public function getSettingsHtml() { return Craft::$app->getView()->renderTemplate( - 'hubspot/_components/connections/applicationKey', + 'flipbox-hubspot/_components/connections/applicationKey', [ 'connection' => $this ] diff --git a/src/connections/PrivateKeyConnection.php b/src/connections/PrivateKeyConnection.php index b3c2a20..cca76dc 100644 --- a/src/connections/PrivateKeyConnection.php +++ b/src/connections/PrivateKeyConnection.php @@ -47,7 +47,7 @@ public static function displayName(): string public function getSettingsHtml() { return Craft::$app->getView()->renderTemplate( - 'hubspot/_components/connections/privateApplicationKey', + 'flipbox-hubspot/_components/connections/privateApplicationKey', [ 'connection' => $this ] diff --git a/src/cp/controllers/view/AbstractController.php b/src/cp/controllers/view/AbstractController.php index 0962deb..e78d7ff 100644 --- a/src/cp/controllers/view/AbstractController.php +++ b/src/cp/controllers/view/AbstractController.php @@ -27,7 +27,7 @@ abstract class AbstractController extends Controller /** * The index view template path */ - const TEMPLATE_BASE = 'hubspot' . '/_cp'; + const TEMPLATE_BASE = 'flipbox-hubspot' . '/_cp'; /******************************************* * BASE PATHS @@ -116,7 +116,7 @@ protected function invalidConnectionModel(): DynamicModel $model->addError( 'connection', 'Invalid connection. ' . - '' . + '' . 'Manage connections to HubSpot' . '.' ); @@ -159,7 +159,7 @@ protected function baseVariables(array &$variables = []) if (!$activeSubNav = Craft::$app->getRequest()->getSegment(2)) { $activeSubNav = 'queries'; } - $variables['selectedSubnavItem'] = 'hubspot.' . $activeSubNav; + $variables['selectedSubnavItem'] = 'flipbox-hubspot.' . $activeSubNav; // Breadcrumbs $variables['crumbs'][] = [ diff --git a/src/fields/Objects.php b/src/fields/Objects.php index b897336..d6c234a 100644 --- a/src/fields/Objects.php +++ b/src/fields/Objects.php @@ -36,47 +36,47 @@ abstract class Objects extends Integrations implements ObjectsFieldInterface /** * @inheritdoc */ - const TRANSLATION_CATEGORY = 'hubspot'; + const TRANSLATION_CATEGORY = 'flipbox-hubspot'; /** * @inheritdoc */ - const INPUT_TEMPLATE_PATH = 'hubspot/_components/fieldtypes/Objects/input'; + const INPUT_TEMPLATE_PATH = 'flipbox-hubspot/_components/fieldtypes/Objects/input'; /** * @inheritdoc */ - const INPUT_ITEM_TEMPLATE_PATH = 'hubspot/_components/fieldtypes/Objects/_inputItem'; + const INPUT_ITEM_TEMPLATE_PATH = 'flipbox-hubspot/_components/fieldtypes/Objects/_inputItem'; /** * @inheritdoc */ - const SETTINGS_TEMPLATE_PATH = 'hubspot/_components/fieldtypes/Objects/settings'; + const SETTINGS_TEMPLATE_PATH = 'flipbox-hubspot/_components/fieldtypes/Objects/settings'; /** * @inheritdoc */ - const ACTION_PREFORM_ACTION_PATH = 'hubspot/cp/fields/perform-action'; + const ACTION_PREFORM_ACTION_PATH = 'flipbox-hubspot/cp/fields/perform-action'; /** * @inheritdoc */ - const ACTION_CREATE_ITEM_PATH = 'hubspot/cp/fields/create-item'; + const ACTION_CREATE_ITEM_PATH = 'flipbox-hubspot/cp/fields/create-item'; /** * @inheritdoc */ - const ACTION_ASSOCIATION_ITEM_PATH = 'hubspot/cp/objects/associate'; + const ACTION_ASSOCIATION_ITEM_PATH = 'flipbox-hubspot/cp/objects/associate'; /** * @inheritdoc */ - const ACTION_DISSOCIATION_ITEM_PATH = 'hubspot/cp/objects/dissociate'; + const ACTION_DISSOCIATION_ITEM_PATH = 'flipbox-hubspot/cp/objects/dissociate'; /** * @inheritdoc */ - const ACTION_PREFORM_ITEM_ACTION_PATH = 'hubspot/cp/fields/perform-item-action'; + const ACTION_PREFORM_ITEM_ACTION_PATH = 'flipbox-hubspot/cp/fields/perform-item-action'; /** * Indicates whether the full sync operation should be preformed if a matching HubSpot Object was found but not diff --git a/src/templates/_components/connections/applicationKey.twig b/src/templates/_components/connections/applicationKey.twig index c97c4a2..25988a6 100644 --- a/src/templates/_components/connections/applicationKey.twig +++ b/src/templates/_components/connections/applicationKey.twig @@ -1,8 +1,8 @@ {% import "_includes/forms" as forms %} {{ forms.autosuggestField({ - label: "Key"|t('hubspot'), - instructions: "The key."|t('hubspot'), + label: "Key"|t('flipbox-hubspot'), + instructions: "The key."|t('flipbox-hubspot'), id: 'key', name: 'key', suggestEnvVars: true, @@ -12,8 +12,8 @@ }) }} {{ forms.autosuggestField({ - label: "Hub Id"|t('hubspot'), - instructions: "The Hub Id."|t('hubspot'), + label: "Hub Id"|t('flipbox-hubspot'), + instructions: "The Hub Id."|t('flipbox-hubspot'), id: 'hubId', name: 'hubId', suggestEnvVars: true, diff --git a/src/templates/_components/connections/privateApplicationKey.twig b/src/templates/_components/connections/privateApplicationKey.twig index ee17879..b4b7e39 100644 --- a/src/templates/_components/connections/privateApplicationKey.twig +++ b/src/templates/_components/connections/privateApplicationKey.twig @@ -1,8 +1,8 @@ {% import "_includes/forms" as forms %} {{ forms.autosuggestField({ - label: "Private Application Key"|t('hubspot'), - instructions: "Reference HubSpot API Docs: https://developers.hubspot.com/docs/api/private-apps"|t('hubspot'), + label: "Private Application Key"|t('flipbox-hubspot'), + instructions: "Reference HubSpot API Docs: https://developers.hubspot.com/docs/api/private-apps"|t('flipbox-hubspot'), id: 'key', name: 'key', suggestEnvVars: true, @@ -12,8 +12,8 @@ }) }} {{ forms.autosuggestField({ - label: "Hub Id"|t('hubspot'), - instructions: "The Hub Id."|t('hubspot'), + label: "Hub Id"|t('flipbox-hubspot'), + instructions: "The Hub Id."|t('flipbox-hubspot'), id: 'hubId', name: 'hubId', suggestEnvVars: true, diff --git a/src/templates/_cp/_layout/_connectionOptions.twig b/src/templates/_cp/_layout/_connectionOptions.twig index 8bf548d..e3a8dc5 100644 --- a/src/templates/_cp/_layout/_connectionOptions.twig +++ b/src/templates/_cp/_layout/_connectionOptions.twig @@ -1,7 +1,7 @@ {% import "_includes/forms" as forms %} {% if not activeConnection %} - Create a connection {{ "to get started."|t('force') }} + Create a connection {{ "to get started."|t('force') }} {% endif %} {% set queryParams = craft.app.request.queryParams|without(craft.app.request.fullPath) %} diff --git a/src/templates/_cp/limits/index.twig b/src/templates/_cp/limits/index.twig index f8d1d8e..7406444 100644 --- a/src/templates/_cp/limits/index.twig +++ b/src/templates/_cp/limits/index.twig @@ -1,7 +1,7 @@ -{% extends "hubspot/_cp/_layout" %} +{% extends "flipbox-hubspot/_cp/_layout" %} {% block contextMenu %} - {% include "hubspot/_cp/_layout/_connectionOptions" with { + {% include "flipbox-hubspot/_cp/_layout/_connectionOptions" with { availableConnections: availableConnections, activeConnection: activeConnection, defaultConnection: defaultConnection @@ -13,8 +13,8 @@   - {{ "Used"|t('hubspot') }} - {{ "Max"|t('hubspot') }} + {{ "Used"|t('flipbox-hubspot') }} + {{ "Max"|t('flipbox-hubspot') }} diff --git a/src/templates/_cp/objects/payload.twig b/src/templates/_cp/objects/payload.twig index 3918e8b..227adb3 100644 --- a/src/templates/_cp/objects/payload.twig +++ b/src/templates/_cp/objects/payload.twig @@ -1,4 +1,4 @@ -{% extends "hubspot/_cp/_layout" %} +{% extends "flipbox-hubspot/_cp/_layout" %} {% import "_includes/forms" as forms %} {% do view.registerJsFile("//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js") %} diff --git a/src/templates/_cp/settings/_layout.twig b/src/templates/_cp/settings/_layout.twig index af21891..653cbda 100644 --- a/src/templates/_cp/settings/_layout.twig +++ b/src/templates/_cp/settings/_layout.twig @@ -1,6 +1,6 @@ {% extends "_layouts/cp" %} {% block sidebar %} - {% set baseCpPath = 'hubspot/settings' %} + {% set baseCpPath = 'flipbox-hubspot/settings' %} {% set selected = selected is defined ? selected : craft.app.request.getSegment(3) %} {% set nav = { general : { diff --git a/src/templates/_cp/settings/connections/index.twig b/src/templates/_cp/settings/connections/index.twig index 29c22a7..ac013d9 100644 --- a/src/templates/_cp/settings/connections/index.twig +++ b/src/templates/_cp/settings/connections/index.twig @@ -1,42 +1,42 @@ -{% extends "hubspot/_cp/settings/_layout" %} +{% extends "flipbox-hubspot/_cp/settings/_layout" %} {% block actionButton %}
{{ "New connection"|t('hubspot') }} + class="btn submit add icon">{{ "New connection"|t('flipbox-hubspot') }}
{% endblock %} {% set content %} - - - - - + + + + + {% if connections|length %} {% for handle, record in connections %} {% set connection = record.connection %} - - - - - @@ -44,7 +44,7 @@ {% else %} {% endif %} diff --git a/src/templates/_cp/settings/connections/upsert.twig b/src/templates/_cp/settings/connections/upsert.twig index 87f5a38..cf2057a 100644 --- a/src/templates/_cp/settings/connections/upsert.twig +++ b/src/templates/_cp/settings/connections/upsert.twig @@ -1,4 +1,4 @@ -{% extends "hubspot/_cp/settings/_layout" %} +{% extends "flipbox-hubspot/_cp/settings/_layout" %} {% import "_includes/forms" as forms %} {% block actionButton %} @@ -27,7 +27,7 @@
  • {{ "Delete"|t('app') }} @@ -47,8 +47,8 @@
    {{ forms.textField({ - label: "Name"|t('hubspot'), - instructions: "The human readable reference to this connection."|t('hubspot'), + label: "Name"|t('flipbox-hubspot'), + instructions: "The human readable reference to this connection."|t('flipbox-hubspot'), id: 'name', name: 'name', value: connection.name ?? '', @@ -57,8 +57,8 @@ }) }} {{ forms.textField({ - label: "Handle"|t('hubspot'), - instructions: "How you’ll refer to this connection in the templates."|t('hubspot'), + label: "Handle"|t('flipbox-hubspot'), + instructions: "How you’ll refer to this connection in the templates."|t('flipbox-hubspot'), id: 'handle', class: 'code', name: 'handle', @@ -77,7 +77,7 @@ {{ forms.selectField({ label: "Type"|t('app'), - instructions: "The type of connection"|t('hubspot'), + instructions: "The type of connection"|t('flipbox-hubspot'), id: 'class', name: 'class', options: typeOptions, @@ -131,7 +131,7 @@
    {% endif %} - {% hook 'hubspot.connection.edit.sidebar' %} + {% hook 'flipbox-hubspot.connection.edit.sidebar' %} {% endblock %} diff --git a/src/templates/_cp/settings/general/index.twig b/src/templates/_cp/settings/general/index.twig index c782b16..b4990e4 100644 --- a/src/templates/_cp/settings/general/index.twig +++ b/src/templates/_cp/settings/general/index.twig @@ -1,17 +1,17 @@ -{% extends "hubspot/_cp/settings/_layout" %} +{% extends "flipbox-hubspot/_cp/settings/_layout" %} {% import "_includes/forms" as forms %} {% set configOverrideMessage %} [Config Override] {% endset %} -{% set config = craft.app.config.getConfigFromFile('hubspot') %} +{% set config = craft.app.config.getConfigFromFile('flipbox-hubspot') %} {% set content %} {{ redirectInput(baseCpPath) }} - {% set connecitonOptions = {(null): '-- Select Connection --'|t('hubspot')} %} + {% set connecitonOptions = {(null): '-- Select Connection --'|t('flipbox-hubspot')} %} {% for connection in connections %} {% set connecitonOptions = connecitonOptions|merge({ (connection.handle): connection.name @@ -20,8 +20,8 @@ {% set connectionOverride = attribute(config, 'defaultConnection') is defined %} {{ forms.selectField({ - label: "Default Connection"|t('hubspot'), - instructions: "The default connection is used when an API request is made without a specified connection." ~ (connectionOverride ? configOverrideMessage : '') |t('hubspot'), + label: "Default Connection"|t('flipbox-hubspot'), + instructions: "The default connection is used when an API request is made without a specified connection." ~ (connectionOverride ? configOverrideMessage : '') |t('flipbox-hubspot'), id: 'defaultConnection', name: 'defaultConnection', value: settings.defaultConnection, @@ -29,7 +29,7 @@ required: true }) }} - {% set cacheOptions = {(null): '-- Select Cache --'|t('hubspot')} %} + {% set cacheOptions = {(null): '-- Select Cache --'|t('flipbox-hubspot')} %} {% for key, config in craft.hubspot.cache.all %} {% set cacheOptions = cacheOptions|merge({ (key): key @@ -38,8 +38,8 @@ {% set cacheOverride = attribute(config, 'defaultCache') is defined %} {{ forms.selectField({ - label: "Default Cache"|t('hubspot'), - instructions: "The default cache is used when an API request is made without a specified cache." ~ (cacheOverride ? configOverrideMessage : '') |t('hubspot'), + label: "Default Cache"|t('flipbox-hubspot'), + instructions: "The default cache is used when an API request is made without a specified cache." ~ (cacheOverride ? configOverrideMessage : '') |t('flipbox-hubspot'), id: 'defaultCache', name: 'defaultCache', value: settings.defaultCache, diff --git a/src/templates/_cp/visitors/detail.twig b/src/templates/_cp/visitors/detail.twig index 74f876a..8f60b40 100644 --- a/src/templates/_cp/visitors/detail.twig +++ b/src/templates/_cp/visitors/detail.twig @@ -1,4 +1,4 @@ -{% extends "hubspot/_cp/_layout" %} +{% extends "flipbox-hubspot/_cp/_layout" %} {% import "_includes/forms" as forms %} {% do view.registerJsFile("//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js") %} @@ -26,7 +26,7 @@
  • {{ "Delete"|t('app') }} @@ -50,7 +50,7 @@ {% block details %}
    {{ forms.selectField({ - label: "Status"|t('hubspot'), + label: "Status"|t('flipbox-hubspot'), id: 'status', name: 'status', showAllOption: true, @@ -63,7 +63,7 @@ {{ forms.lightswitchField({ - label: "Sync from HubSpot"|t('hubspot'), + label: "Sync from HubSpot"|t('flipbox-hubspot'), id: 'queue', name: 'queue', on: false diff --git a/src/templates/_cp/visitors/index.twig b/src/templates/_cp/visitors/index.twig index 71812dc..1e8e361 100644 --- a/src/templates/_cp/visitors/index.twig +++ b/src/templates/_cp/visitors/index.twig @@ -1,7 +1,7 @@ -{% extends "hubspot/_cp/_layout" %} +{% extends "flipbox-hubspot/_cp/_layout" %} {% block contextMenu %} - {% include "hubspot/_cp/_layout/_connectionOptions" with { + {% include "flipbox-hubspot/_cp/_layout/_connectionOptions" with { availableConnections: availableConnections, activeConnection: activeConnection, defaultConnection: defaultConnection @@ -12,25 +12,25 @@ {% from _self import statusIndicator %}
    {% if visitors|length %}
  • {{ "Name"|t('hubspot') }}{{ "Handle"|t('hubspot') }}{{ "Hub Id"|t('hubspot') }}{{ "Type"|t('hubspot') }}{{ "Default"|t('hubspot') }}{{ "Name"|t('flipbox-hubspot') }}{{ "Handle"|t('flipbox-hubspot') }}{{ "Hub Id"|t('flipbox-hubspot') }}{{ "Type"|t('flipbox-hubspot') }}{{ "Default"|t('flipbox-hubspot') }}
    + {{ record.name }} + {{ record.handle }} + {{ connection.hubId }} + {{ connection.displayName() }} +
    - {{ "No connections exist yet."|t('hubspot') }} + {{ "No connections exist yet."|t('flipbox-hubspot') }}
    - - - + + + {% for visitor in visitors %} - - - + + {% endfor %} diff --git a/src/templates/_patron/providers/settings.twig b/src/templates/_patron/providers/settings.twig index 2b64e6f..1f4a345 100644 --- a/src/templates/_patron/providers/settings.twig +++ b/src/templates/_patron/providers/settings.twig @@ -15,7 +15,7 @@ {{ forms.checkboxSelectField({ label: "Scopes"|t('guardian'), - instructions: "Select the available default scopes."|t('hubspot'), + instructions: "Select the available default scopes."|t('flipbox-hubspot'), id: 'defaultScopes', name: 'defaultScopes', showAllOption: false,
    {{ "Token"|t('hubspot') }}{{ "Updated"|t('hubspot') }}{{ "Created"|t('hubspot') }}{{ "Token"|t('flipbox-hubspot') }}{{ "Updated"|t('flipbox-hubspot') }}{{ "Created"|t('flipbox-hubspot') }}
    + {{ statusIndicator(visitor.status) }} {{ visitor.token }} {{ visitor.dateUpdated|datetime('short') }}{{ visitor.dateCreated|datetime('short') }}{{ visitor.dateUpdated|datetime('short') }}{{ visitor.dateCreated|datetime('short') }}