From 0d9b312a9b86ad88872685489af4dcfc71f44ef6 Mon Sep 17 00:00:00 2001 From: Marc Michalsky forumZFD Date: Mon, 12 Apr 2021 09:47:42 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9E=95=EF=B8=8F=20change=20json=20files=20to?= =?UTF-8?q?=20php=20files=20and=20add=20custom=20fields=20for=20projects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changeing the file type is necessary to use the ts() function during custom field creation. Added new custom fields to map the donation form settings. --- CRM/TwingleCampaign/BAO/TwingleCampaign.php | 2 +- CRM/TwingleCampaign/Utils/ExtensionCache.php | 67 +- CRM/TwingleCampaign/resources/campaigns.json | 469 ------- CRM/TwingleCampaign/resources/campaigns.php | 1082 +++++++++++++++++ CRM/TwingleCampaign/resources/dictionary.json | 13 - CRM/TwingleCampaign/resources/dictionary.php | 18 + .../resources/option_values.json | 8 - .../resources/option_values.php | 10 + .../resources/twingle_api_templates.json | 61 - .../resources/twingle_api_templates.php | 114 ++ api/v3/TwingleCampaign/Get.php | 2 +- twinglecampaign.php | 22 +- 12 files changed, 1262 insertions(+), 606 deletions(-) delete mode 100644 CRM/TwingleCampaign/resources/campaigns.json create mode 100644 CRM/TwingleCampaign/resources/campaigns.php delete mode 100644 CRM/TwingleCampaign/resources/dictionary.json create mode 100644 CRM/TwingleCampaign/resources/dictionary.php delete mode 100644 CRM/TwingleCampaign/resources/option_values.json create mode 100644 CRM/TwingleCampaign/resources/option_values.php delete mode 100644 CRM/TwingleCampaign/resources/twingle_api_templates.json create mode 100644 CRM/TwingleCampaign/resources/twingle_api_templates.php diff --git a/CRM/TwingleCampaign/BAO/TwingleCampaign.php b/CRM/TwingleCampaign/BAO/TwingleCampaign.php index c50118e..f7e8521 100644 --- a/CRM/TwingleCampaign/BAO/TwingleCampaign.php +++ b/CRM/TwingleCampaign/BAO/TwingleCampaign.php @@ -96,7 +96,7 @@ class CRM_TwingleCampaign_BAO_TwingleCampaign { // Get campaign type id for TwingleProject $twingle_project_campaign_type_id = ExtensionCache::getInstance() - ->getCampaigns()['campaign_types']['twingle_project']['id']; + ->getCampaignIds()['campaign_types']['twingle_project']['id']; // Determine the parent project id by looping through the campaign tree // until the parent campaign type is a TwingleProject diff --git a/CRM/TwingleCampaign/Utils/ExtensionCache.php b/CRM/TwingleCampaign/Utils/ExtensionCache.php index 365b50a..f813d9a 100644 --- a/CRM/TwingleCampaign/Utils/ExtensionCache.php +++ b/CRM/TwingleCampaign/Utils/ExtensionCache.php @@ -13,13 +13,7 @@ class CRM_TwingleCampaign_Utils_ExtensionCache { private $customFieldMapping; - private $translations; - - private $campaigns; - - private $templates; - - private $option_values; + private $campaignIds; /** * ## Get an instance (singleton) @@ -44,37 +38,11 @@ class CRM_TwingleCampaign_Utils_ExtensionCache { // Get a mapping of custom fields $this->customFieldMapping = CustomField::getMapping(); - // Initialize json files as arrays - $file_paths = [ - 'translations' => '/CRM/TwingleCampaign/resources/dictionary.json', - 'templates' => '/CRM/TwingleCampaign/resources/twingle_api_templates.json', - 'campaigns' => '/CRM/TwingleCampaign/resources/campaigns.json', - 'option_values' => '/CRM/TwingleCampaign/resources/option_values.json', - ]; - - foreach ($file_paths as $key => $file_path) { - - // Get array from json file - $file_path = E::path() . $file_path; - $json_file = file_get_contents($file_path); - $json_file_name = pathinfo($file_path)['filename']; - $array = json_decode($json_file, TRUE); - - // Throw and log an error if json file can't be read - if (!$array) { - $message = ($json_file_name) - ? "Could not read json file $json_file_name" - : "Could not locate json file in path: $file_path"; - Civi::log()->error($message); - throw new Exception($message); - } - - // Set attribute - $this->$key = $array; - } - // Get ids for Twingle related campaign types - foreach ($this->campaigns['campaign_types'] as $campaign_type) { + $this->campaignIds = require( + E::path() . '/CRM/TwingleCampaign/resources/campaigns.php' + ); + foreach ($this->campaignIds['campaign_types'] as $campaign_type) { $campaign_type_id = civicrm_api3( 'OptionValue', 'get', @@ -85,7 +53,7 @@ class CRM_TwingleCampaign_Utils_ExtensionCache { ] )['values']; if ($campaign_type_id) { - $this->campaigns['campaign_types'][$campaign_type['name']]['id'] = + $this->campaignIds['campaign_types'][$campaign_type['name']]['id'] = $campaign_type_id[0]['value']; } } @@ -114,28 +82,43 @@ class CRM_TwingleCampaign_Utils_ExtensionCache { * @return array */ public function getTranslations(): array { - return $this->translations; + return require( + E::path() . '/CRM/TwingleCampaign/resources/dictionary.php' + ); } /** * @return array */ public function getCampaigns(): array { - return $this->campaigns; + return require( + E::path() . '/CRM/TwingleCampaign/resources/campaigns.php' + ); + } + + /** + * @return array + */ + public function getCampaignIds(): array { + return $this->campaignIds; } /** * @return array */ public function getTemplates(): array { - return $this->templates; + return require( + E::path() . '/CRM/TwingleCampaign/resources/twingle_api_templates.php' + ); } /** * @return mixed */ public function getOptionValues() { - return $this->option_values; + return require( + E::path() . '/CRM/TwingleCampaign/resources/option_values.php' + ); } } \ No newline at end of file diff --git a/CRM/TwingleCampaign/resources/campaigns.json b/CRM/TwingleCampaign/resources/campaigns.json deleted file mode 100644 index aff49a7..0000000 --- a/CRM/TwingleCampaign/resources/campaigns.json +++ /dev/null @@ -1,469 +0,0 @@ -{ - "campaign_types": { - "twingle_project": { - "name": "twingle_project", - "label": "Twingle Project" - }, - "twingle_event": { - "name": "twingle_event", - "label": "Twingle Event" - }, - "twingle_campaign": { - "name": "twingle_campaign", - "label": "Twingle Campaign" - } - }, - "custom_groups": { - "twingle_project_information": { - "title": "Twingle Project Information", - "name": "Twingle_Project_Information", - "extends": "Campaign", - "campaign_type": "twingle_project", - "weight": "1" - }, - "twingle_project_embed_codes": { - "title": "Twingle Project Embed Codes", - "name": "Twingle_Project_Embed_Codes", - "extends": "Campaign", - "campaign_type": "twingle_project", - "collapse_display": "1", - "weight": "2" - }, - "twingle_event_information": { - "title": "Twingle Event Information", - "name": "Twingle_Event_Information", - "extends": "Campaign", - "campaign_type": "twingle_event" - }, - "twingle_campaign_information": { - "title": "Twingle Campaign Information", - "name": "Twingle_Campaign_Information", - "extends": "Campaign", - "campaign_type": "twingle_campaign" - } - }, - "custom_fields": { - "twingle_project_id": { - "custom_group_id": "Twingle_Project_Information", - "label": "Twingle Project ID", - "name": "twingle_project_id", - "is_required": 0, - "is_searchable": 1, - "data_type": "String", - "html_type": "Text", - "text_length": 16, - "is_active": 1, - "is_view": 1, - "weight": 1 - }, - "twingle_project_organisation_id": { - "custom_group_id": "Twingle_Project_Information", - "label": "Twingle Project organisation ID", - "name": "twingle_project_organisation_id", - "is_required": 0, - "is_searchable": 1, - "data_type": "String", - "html_type": "Text", - "text_length": 32, - "is_active": 1, - "is_view": 1, - "weight": 6 - }, - "twingle_project_identifier": { - "custom_group_id": "Twingle_Project_Information", - "label": "Twingle Project identifier", - "name": "twingle_project_identifier", - "is_required": 0, - "is_searchable": 1, - "data_type": "String", - "html_type": "Text", - "text_length": 15, - "is_active": 1, - "is_view": 1, - "weight": 3, - "help_post": "An unique identifier for a project (auto generated)" - }, - "twingle_project_type": { - "custom_group_id": "Twingle_Project_Information", - "label": "Twingle Project Type", - "name": "twingle_project_type", - "is_required": 0, - "is_searchable": 1, - "data_type": "String", - "html_type": "Select", - "option_values": { - "default": "Default", - "event": "Events", - "membership": "Membership" - }, - "text_length": 32, - "is_active": 1, - "is_view": 0, - "weight": 2, - "help_post": "Choose the project type. Allow users to create own events or to pay a membership fee.", - "default_value": "default" - }, - "twingle_project_allow_more": { - "custom_group_id": "Twingle_Project_Information", - "label": "Twingle Project allow more", - "name": "twingle_project_allow_more", - "is_required": 0, - "is_searchable": 1, - "data_type": "Boolean", - "html_type": "Radio", - "text_length": 4, - "is_active": 1, - "is_view": 0, - "weight": 4, - "help_post": "Allow to donate more than is defined in the target" - }, - "twingle_project_transaction_type": { - "custom_group_id": "Twingle_Project_Information", - "label": "Twingle Project transaction type", - "name": "twingle_project_transaction_type", - "is_required": 0, - "is_searchable": 1, - "data_type": "String", - "html_type": "Text", - "text_length": 32, - "is_active": 1, - "is_view": 0, - "weight": 5 - }, - "twingle_project_url": { - "custom_group_id": "Twingle_Project_Information", - "label": "Twingle Project URL", - "name": "twingle_project_url", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "TextArea", - "text_length": 600, - "is_active": 1, - "is_view": 0, - "weight": 6 - }, - "twingle_project_widget": { - "custom_group_id": "Twingle_Project_Embed_Codes", - "label": "Twingle Project Widget", - "name": "twingle_project_widget", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "TextArea", - "text_length": 600, - "is_active": 1, - "is_view": 1, - "weight": 1 - }, - "twingle_project_form": { - "custom_group_id": "Twingle_Project_Embed_Codes", - "label": "Twingle Project Form", - "name": "twingle_project_form", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "TextArea", - "text_length": 600, - "is_active": 1, - "is_view": 1, - "weight": 2 - }, - "twingle_project_widget-single": { - "custom_group_id": "Twingle_Project_Embed_Codes", - "label": "Twingle Project Widget Single", - "name": "twingle_project_widget-single", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "TextArea", - "text_length": 600, - "is_active": 1, - "is_view": 1, - "weight": 3 - }, - "twingle_project_form-single": { - "custom_group_id": "Twingle_Project_Embed_Codes", - "label": "Twingle Project Form Single", - "name": "twingle_project_form-single", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "TextArea", - "text_length": 600, - "is_active": 1, - "is_view": 1, - "weight": 4 - }, - "twingle_project_eventall": { - "custom_group_id": "Twingle_Project_Embed_Codes", - "label": "Twingle Project All Events", - "name": "twingle_project_eventall", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "TextArea", - "text_length": 1300, - "is_active": 1, - "is_view": 1, - "weight": 5 - }, - "twingle_project_eventlist": { - "custom_group_id": "Twingle_Project_Embed_Codes", - "label": "Twingle Project Event List", - "name": "twingle_project_eventlist", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "TextArea", - "text_length": 1300, - "is_active": 1, - "is_view": 1, - "weight": 6 - }, - "twingle_project_counter": { - "custom_group_id": "Twingle_Project_Embed_Codes", - "label": "Twingle Project Counter", - "name": "twingle_project_counter", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "TextArea", - "text_length": 120, - "is_active": 1, - "is_view": 1, - "weight": 7 - }, - "twingle_project_page": { - "custom_group_id": "Twingle_Project_Embed_Codes", - "label": "Twingle Project Page", - "name": "twingle_project_page", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "TextArea", - "text_length": 600, - "is_active": 1, - "is_view": 1, - "weight": 8 - }, - "twingle_event_id": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event ID", - "name": "twingle_event_id", - "is_required": 1, - "is_searchable": 1, - "data_type": "String", - "html_type": "Text", - "text_length": 16, - "is_active": 1, - "is_view": 1, - "weight": 1 - }, - "twingle_event_project_id": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Project ID", - "name": "twingle_event_project_id", - "is_required": 0, - "is_searchable": 1, - "data_type": "String", - "html_type": "Text", - "text_length": 16, - "is_active": 1, - "is_view": 1, - "weight": 2 - }, - "twingle_event_identifier": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Identifier", - "name": "twingle_event_identifier", - "is_required": 0, - "is_searchable": 0, - "data_type": "String", - "html_type": "Text", - "text_length": 16, - "is_active": 1, - "is_view": 1, - "weight": 3 - }, - "twingle_event_contact": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Initiator", - "name": "twingle_event_contact", - "is_required": 0, - "is_searchable": 1, - "data_type": "ContactReference", - "html_type": "Autocomplete-Select", - "is_active": 1, - "is_view": 0, - "weight": 5 - }, - "twingle_event_user_email": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Initiator Email", - "name": "twingle_event_user_email", - "is_required": 0, - "is_searchable": 0, - "data_type": "String", - "html_type": "Text", - "text_length": 128, - "is_active": 1, - "is_view": 1, - "weight": 6 - }, - "twingle_event_is_public": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event is public", - "name": "twingle_event_is_public", - "is_required": 0, - "is_searchable": 1, - "data_type": "Boolean", - "html_type": "Radio", - "is_active": 1, - "is_view": 1, - "weight": 7 - }, - "twingle_event_deleted": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Deleted", - "name": "twingle_event_deleted", - "is_required": 0, - "is_searchable": 1, - "data_type": "Boolean", - "html_type": "Radio", - "is_active": 1, - "is_view": 1, - "weight": 8 - }, - "twingle_event_confirmed_at": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Confirmed At", - "name": "twingle_event_confirmed_at", - "is_required": 0, - "is_searchable": 0, - "data_type": "String", - "html_type": "Text", - "text_length": 64, - "is_active": 1, - "is_view": 1, - "weight": 9 - }, - "twingle_event_created_at": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Created At", - "name": "twingle_event_created_at", - "is_required": 0, - "is_searchable": 0, - "data_type": "String", - "html_type": "Text", - "text_length": 64, - "is_active": 1, - "is_view": 1, - "weight": 10 - }, - "twingle_event_creation_url": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Creation URL", - "name": "twingle_event_creation_url", - "is_required": 0, - "is_searchable": 0, - "data_type": "String", - "html_type": "Text", - "text_length": 256, - "is_active": 1, - "is_view": 1, - "weight": 11 - }, - "twingle_event_url_internal": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Internal URL", - "name": "twingle_event_url_internal", - "is_required": 0, - "is_searchable": 0, - "data_type": "String", - "html_type": "Text", - "text_length": 256, - "is_active": 1, - "is_view": 1, - "weight": 12 - }, - "twingle_event_url_external": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event External URL", - "name": "twingle_event_url_external", - "is_required": 0, - "is_searchable": 0, - "data_type": "String", - "html_type": "Text", - "text_length": 256, - "is_active": 1, - "is_view": 1, - "weight": 13 - }, - "twingle_event_url_edit_internal": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Edit Internal URL", - "name": "twingle_event_url_edit_internal", - "is_required": 0, - "is_searchable": 0, - "data_type": "String", - "html_type": "Text", - "text_length": 256, - "is_active": 1, - "is_view": 1, - "weight": 14 - }, - "twingle_event_url_edit_external": { - "custom_group_id": "Twingle_Event_Information", - "label": "Twingle Event Edit External URL", - "name": "twingle_event_url_edit_external", - "is_required": 0, - "is_searchable": 0, - "data_type": "String", - "html_type": "Text", - "text_length": 256, - "is_active": 1, - "is_view": 1, - "weight": 15 - }, - "twingle_campaign_parent_project_id": { - "custom_group_id": "Twingle_Campaign_Information", - "label": "Parent TwingleProject ID", - "name": "twingle_campaign_parent_project_id", - "is_required": 0, - "is_searchable": 1, - "data_type": "String", - "html_type": "Text", - "text_length": 16, - "is_active": 1, - "is_view": 1, - "weight": 1 - }, - "twingle_campaign_cid": { - "custom_group_id": "Twingle_Campaign_Information", - "label": "Twingle Campaign CID", - "name": "twingle_campaign_cid", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "Text", - "text_length": 32, - "is_active": 1, - "is_view": 1, - "weight": 2 - }, - "twingle_campaign_url": { - "custom_group_id": "Twingle_Campaign_Information", - "label": "Twingle Campaign URL", - "name": "twingle_campaign_url", - "is_required": 0, - "is_searchable": 0, - "data_type": "Memo", - "html_type": "TextArea", - "text_length": 600, - "is_active": 1, - "is_view": 1, - "weight": 3 - } - } -} diff --git a/CRM/TwingleCampaign/resources/campaigns.php b/CRM/TwingleCampaign/resources/campaigns.php new file mode 100644 index 0000000..1dbeba8 --- /dev/null +++ b/CRM/TwingleCampaign/resources/campaigns.php @@ -0,0 +1,1082 @@ + [ + "twingle_project" => [ + "name" => "twingle_project", + "label" => "Twingle Project" + ], + "twingle_event" => [ + "name" => "twingle_event", + "label" => "Twingle Event" + ], + "twingle_campaign" => [ + "name" => "twingle_campaign", + "label" => "Twingle Campaign" + ] + ], + "custom_groups" => [ + "twingle_project_information" => [ + "title" => E::ts("Twingle Information"), + "name" => "Twingle_Project_Information", + "extends" => "Campaign", + "campaign_type" => "twingle_project", + "weight" => "1" + ], + "twingle_project_options" => [ + "title" => E::ts("Twingle Settings"), + "name" => "Twingle_Project_Options", + "extends" => "Campaign", + "campaign_type" => "twingle_project", + "weight" => "2" + ], + "twingle_project_payment_methods" => [ + "title" => E::ts("Twingle Payment Methods"), + "name" => "Twingle_Project_Payment_Methods", + "extends" => "Campaign", + "campaign_type" => "twingle_project", + "weight" => "3" + ], + "twingle_project_embed_codes" => [ + "title" => E::ts("Twingle Embed Codes"), + "name" => "Twingle_Project_Embed_Codes", + "extends" => "Campaign", + "campaign_type" => "twingle_project", + "collapse_display" => "1", + "weight" => "4" + ], + "twingle_event_information" => [ + "title" => E::ts("Twingle Event Information"), + "name" => "Twingle_Event_Information", + "extends" => "Campaign", + "campaign_type" => "twingle_event" + ], + "twingle_campaign_information" => [ + "title" => E::ts("Twingle Campaign Information"), + "name" => "Twingle_Campaign_Information", + "extends" => "Campaign", + "campaign_type" => "twingle_campaign" + ] + ], + "custom_fields" => [ + "twingle_project_id" => [ + "custom_group_id" => "Twingle_Project_Information", + "label" => E::ts("Twingle Project ID"), + "name" => "twingle_project_id", + "is_required" => FALSE, + "is_searchable" => 1, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 16, + "is_active" => 1, + "is_view" => 1, + "weight" => 1 + ], + "twingle_project_organisation_id" => [ + "custom_group_id" => "Twingle_Project_Information", + "label" => E::ts("Organisation ID"), + "name" => "twingle_project_organisation_id", + "is_required" => FALSE, + "is_searchable" => 1, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 32, + "is_active" => 1, + "is_view" => 1, + "weight" => 6 + ], + "twingle_project_identifier" => [ + "custom_group_id" => "Twingle_Project_Information", + "label" => E::ts("identifier"), + "name" => "twingle_project_identifier", + "is_required" => FALSE, + "is_searchable" => 1, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 15, + "is_active" => 1, + "is_view" => 1, + "weight" => 3, + "help_post" => E::ts("An unique identifier for a project (auto generated)") + ], + "twingle_project_type" => [ + "custom_group_id" => "Twingle_Project_Information", + "label" => E::ts("Type"), + "name" => "twingle_project_type", + "is_required" => FALSE, + "is_searchable" => 1, + "data_type" => "String", + "html_type" => "Select", + "option_values" => [ + "default" => E::ts("Default"), + "event" => E::ts("Events"), + "membership" => E::ts("Membership") + ], + "text_length" => 32, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 2, + "help_post" => E::ts("Choose the project type. Allow users to create own events or to pay a membership fee."), + "default_value" => "default" + ], + "twingle_project_allow_more" => [ + "custom_group_id" => "Twingle_Project_Information", + "label" => E::ts("allow more"), + "name" => "twingle_project_allow_more", + "is_required" => FALSE, + "is_searchable" => 1, + "data_type" => "Boolean", + "html_type" => "Radio", + "text_length" => 4, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 4, + "help_post" => E::ts("Allow to donate more than is defined in the target") + ], + "twingle_project_transaction_type" => [ + "custom_group_id" => "Twingle_Project_Information", + "label" => E::ts("transaction type"), + "name" => "twingle_project_transaction_type", + "is_required" => FALSE, + "is_searchable" => 1, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 32, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 5 + ], + "twingle_project_url" => [ + "custom_group_id" => "Twingle_Project_Information", + "label" => E::ts("URL"), + "name" => "twingle_project_url", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "TextArea", + "text_length" => 600, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 6 + ], + "twingle_project_widget" => [ + "custom_group_id" => "Twingle_Project_Embed_Codes", + "label" => E::ts("Widget"), + "name" => "twingle_project_widget", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "TextArea", + "text_length" => 600, + "is_active" => 1, + "is_view" => 1, + "weight" => 1 + ], + "twingle_project_form" => [ + "custom_group_id" => "Twingle_Project_Embed_Codes", + "label" => E::ts("Form"), + "name" => "twingle_project_form", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "TextArea", + "text_length" => 600, + "is_active" => 1, + "is_view" => 1, + "weight" => 2 + ], + "twingle_project_widget-single" => [ + "custom_group_id" => "Twingle_Project_Embed_Codes", + "label" => E::ts("Widget Single"), + "name" => "twingle_project_widget-single", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "TextArea", + "text_length" => 600, + "is_active" => 1, + "is_view" => 1, + "weight" => 3 + ], + "twingle_project_form-single" => [ + "custom_group_id" => "Twingle_Project_Embed_Codes", + "label" => E::ts("Form Single"), + "name" => "twingle_project_form-single", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "TextArea", + "text_length" => 600, + "is_active" => 1, + "is_view" => 1, + "weight" => 4 + ], + "twingle_project_eventall" => [ + "custom_group_id" => "Twingle_Project_Embed_Codes", + "label" => E::ts("All Events"), + "name" => "twingle_project_eventall", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "TextArea", + "text_length" => 1300, + "is_active" => 1, + "is_view" => 1, + "weight" => 5 + ], + "twingle_project_eventlist" => [ + "custom_group_id" => "Twingle_Project_Embed_Codes", + "label" => E::ts("Event List"), + "name" => "twingle_project_eventlist", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "TextArea", + "text_length" => 1300, + "is_active" => 1, + "is_view" => 1, + "weight" => 6 + ], + "twingle_project_counter" => [ + "custom_group_id" => "Twingle_Project_Embed_Codes", + "label" => E::ts("Counter"), + "name" => "twingle_project_counter", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "TextArea", + "text_length" => 120, + "is_active" => 1, + "is_view" => 1, + "weight" => 7 + ], + "twingle_project_page" => [ + "custom_group_id" => "Twingle_Project_Embed_Codes", + "label" => E::ts("Page"), + "name" => "twingle_project_page", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "TextArea", + "text_length" => 600, + "is_active" => 1, + "is_view" => 1, + "weight" => 8 + ], + "twingle_project_has_confirmation_mail" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Confirmation Mail"), + "name" => "twingle_project_has_confirmation_mail", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "text_length" => 6, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 1, + "help_post" => E::ts("Send confirmation mail") + ], + "twingle_project_has_donation_receipt" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Donation Receipt"), + "name" => "twingle_project_has_donation_receipt", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "text_length" => 6, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 3, + "help_post" => E::ts("Offer donation receipts") + ], + "twingle_project_has_contact_data" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Contact Data"), + "name" => "twingle_project_has_contact_data", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "text_length" => 6, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 4 + ], + "twingle_project_donation_rhythm" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Donation Rhythm"), + "name" => "twingle_project_donation_rhythm", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Multi-Select", + "option_values" => [ + "yearly" => E::ts("yearly"), + "halfyearly" => E::ts("halfyearly"), + "quarterly" => E::ts("quarterly"), + "monthly" => E::ts("monthly"), + "one_time" => E::ts("one time") + ], + "text_length" => 64, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 5, + "help_post" => E::ts("The selected options are available for selection in the donation widget.") + ], + "twingle_project_default_rhythm" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Default Rhythm"), + "name" => "twingle_project_default_rhythm", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Radio", + "option_values" => [ + "yearly" => E::ts("yearly"), + "halfyearly" => E::ts("halfyearly"), + "quarterly" => E::ts("quarterly"), + "monthly" => E::ts("monthly"), + "one_time" => E::ts("one time") + ], + "text_length" => 64, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 6, + "help_post" => E::ts("Which donation rhythm should be displayed as selected by default?") + ], + "twingle_project_has_newsletter_registration" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Newsletter Registration"), + "name" => "twingle_project_has_newsletter_registration", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "text_length" => 6, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 7, + "help_post" => E::ts("Enable newsletter registration") + ], + "twingle_project_has_postinfo_registration" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Postinfo Registration"), + "name" => "twingle_project_has_postinfo_registration", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "text_length" => 6, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 8, + "help_post" => E::ts("Enable post info registration") + ], + "twingle_project_design_background_color" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Background Color"), + "name" => "twingle_project_design_background_color", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 6, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 9, + "help_post" => E::ts("Hex color code (e.g. ffffff for white)") + ], + "twingle_project_design_primary_color" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Primary Color"), + "name" => "twingle_project_design_primary_color", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 6, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 10, + "help_post" => E::ts("Hex color code (e.g. ffffff for white)") + ], + "twingle_project_design_font_color" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Font Color"), + "name" => "twingle_project_design_font_color", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 6, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 12, + "help_post" => E::ts("Hex color code (e.g. ffffff for white)") + ], + "twingle_project_bcc_email_address" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("BCC Email"), + "name" => "twingle_project_bcc_email_address", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 64, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 16, + "help_post" => E::ts("Email address used as bcc addresses for confirmation mail which is send to an user") + ], + "twingle_project_donation_value_min" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Donation Min"), + "name" => "twingle_project_donation_value_min", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 10, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 17, + "help_post" => E::ts("Minimum donation value"), + "default_value" => "5" + ], + "twingle_project_donation_value_max" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Donation Max"), + "name" => "twingle_project_donation_value_max", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 10, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 18, + "help_post" => E::ts("Maximum donation value"), + "default_value" => "500" + ], + "twingle_project_donation_value_default" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Donation Default"), + "name" => "twingle_project_donation_value_default", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 10, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 19, + "help_post" => E::ts("Default donation value"), + "default_value" => "50" + ], + "twingle_project_contact_fields" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Contact Fields"), + "name" => "twingle_project_contact_fields", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Multi-Select", + "option_values" => [ + "salutation" => E::ts("Salutation"), + "firstname" => E::ts("First name"), + "lastname" => E::ts("Last name"), + "company" => E::ts("Company"), + "birthday" => E::ts("Birthday"), + "street" => E::ts("Street"), + "postal_code" => E::ts("Postal Code"), + "city" => E::ts("City"), + "country" => E::ts("Country"), + "telephone" => E::ts("Telephone") + ], + "is_active" => 1, + "is_view" => FALSE, + "weight" => 20, + "help_post" => E::ts("Fields to include in contact form") + ], + "twingle_project_mandatory_contact_fields" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Mandatory Contact Fields"), + "name" => "twingle_project_mandatory_contact_fields", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Multi-Select", + "option_values" => [ + "salutation" => E::ts("Salutation"), + "firstname" => E::ts("First name"), + "lastname" => E::ts("Last name"), + "company" => E::ts("Company"), + "birthday" => E::ts("Birthday"), + "street" => E::ts("Street"), + "postal_code" => E::ts("Postal Code"), + "city" => E::ts("City"), + "country" => E::ts("Country"), + "telephone" => E::ts("Telephone") + ], + "is_active" => 1, + "is_view" => FALSE, + "weight" => 20, + "help_post" => E::ts("Fields that must get filled in the contact form.") + ], + "twingle_project_custom_css" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Custom CSS"), + "name" => "twingle_project_custom_css", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 120, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 21, + "help_post" => E::ts("URL to a custom CSS file that will be included in the frontend") + ], + "twingle_project_share_url" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Share URL"), + "name" => "twingle_project_share_url", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 120, + "is_active" => 1, + "is_view" => FALSE, + "weight" => 22, + "help_post" => E::ts("URL for the sharing component on the last page and doi page") + ], + "twingle_project_has_contact_mandatory" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Contact Mandatory"), + "name" => "twingle_project_has_contact_mandatory", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => 1, + "is_view" => FALSE, + "weight" => 23, + "help_post" => E::ts("If the contact data should be requested mandatory as second step") + ], + "twingle_project_has_doi" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Double Opt-In"), + "name" => "twingle_project_has_doi", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => 1, + "is_view" => FALSE, + "weight" => 24, + "help_post" => E::ts("Enable Twingle's double opt-in (Do not enable, if you use CiviCRM's double opt-in!)") + ], + "twingle_project_has_force_donation_target_buttons" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Force Donation Taget as Button"), + "name" => "twingle_project_has_force_donation_target_buttons", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => 1, + "is_view" => FALSE, + "weight" => 26, + "help_post" => E::ts("Force showing the donation targets as buttons") + ], + "twingle_project_slidericon" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Slider Icon"), + "name" => "twingle_project_slidericon", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Select", + "option_values" => [ + "heart" => E::ts("Heart"), + "asterisk" => E::ts("Asterisk"), + "animal" => E::ts("Animal"), + "Rettungsring" => E::ts("Lifebelt"), + "angellist" => E::ts("Angellist"), + "handshake" => E::ts("Handshake"), + "dollar" => E::ts("Dollar"), + "menue_burger_fine" => E::ts("Menue"), + "office" => E::ts("Office"), + "leaf" => E::ts("Leaf"), + "cog" => E::ts("Cog"), + "wvg" => E::ts("SVG"), + "euro" => E::ts("Euro"), + "stats-dots" => E::ts("Stats"), + "circle_fine" => E::ts("Circle"), + "waterdrop_outline" => E::ts("Water drop outline"), + "waterdrop" => E::ts("Water drop"), + "gift" => E::ts("Gift"), + "biene_b" => E::ts("Bee"), + "blume" => E::ts("Flower"), + "train" => E::ts("Train"), + "empty" => E::ts("No Icon") + ], + "is_active" => 1, + "is_view" => FALSE, + "weight" => 29 + ], + "twingle_project_has_hidden_logo" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Hidden Logo"), + "name" => "twingle_project_has_hidden_logo", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => 1, + "is_view" => FALSE, + "weight" => 35, + "help_post" => E::ts("Hide the Logo on the project page") + ], + "twingle_project_has_projecttarget_as_money" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Target Format"), + "name" => "twingle_project_has_projecttarget_as_money", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => 1, + "is_view" => FALSE, + "weight" => 36, + "help_post" => E::ts("Format of the reached portion of the donation target"), + "default_value" => "0" + ], + "twingle_project_has_donationtarget_textfield" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Donation Purpose as Textfield"), + "name" => "twingle_project_has_donationtarget_textfield", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => 1, + "is_view" => FALSE, + "weight" => 37, + "help_post" => E::ts("Let donors enter their own donation purpose") + ], + "twingle_project_has_civi_crm_activated" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Activate CiviCRM Support"), + "name" => "twingle_project_has_civi_crm_activated", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => 1, + "is_view" => FALSE, + "weight" => 38, + "help_post" => E::ts("Activate support for Twingle Extension (de.systopia.twingle)"), + "default_value" => TRUE, + ], + "twingle_project_has_step_index" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Show Step Index"), + "name" => "twingle_project_has_step_index", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 39, + "help_post" => E::ts("Show a step index during donation process") + ], + "twingle_project_languages" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Languages"), + "name" => "twingle_project_languages", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Multi-Select", + "option_values" => [ + "de" => E::ts("German"), + "en" => E::ts("English"), + "fr" => E::ts("French"), + "es" => E::ts("Spanish") + ], + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 43 + ], + "twingle_project_has_buttons" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Buttons"), + "name" => "twingle_project_has_buttons", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 44, + "help_post" => E::ts("Up to four buttons can be configured. If you leave the amount blank, the button will not be displayed.") + ], + "twingle_project_has_no_slider" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Slider"), + "name" => "twingle_project_has_no_slider", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 44, + "help_post" => E::ts("Show a slider that allows the donor to choose the donation amount.") + ], + "twingle_project_button1" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Button 1"), + "name" => "twingle_project_button1", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 10, + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 44, + "help_post" => E::ts("Amount to be displayed on Button 1") + ], + "twingle_project_button2" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Button 2"), + "name" => "twingle_project_button2", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 10, + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 44, + "help_post" => E::ts("Amount to be displayed on Button 2") + ], + "twingle_project_button3" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Button 3"), + "name" => "twingle_project_button3", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 10, + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 44, + "help_post" => E::ts("Amount to be displayed on Button 3") + ], + "twingle_project_button4" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Button 4"), + "name" => "twingle_project_button4", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 10, + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 44, + "help_post" => E::ts("Amount to be displayed on Button 4") + ], + "twingle_project_has_newsletter_namerequest" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Newsletter Name Requested"), + "name" => "twingle_project_has_newsletter_namerequest", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 44, + "help_post" => E::ts("Must a donor give his name for newsletter sign-up?") + ], + "twingle_project_has_show_donator_data" => [ + "custom_group_id" => "Twingle_Project_Options", + "label" => E::ts("Show List of Donations"), + "name" => "twingle_project_has_show_donator_data", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 44, + "help_post" => E::ts("Display a list of public donations") + ], + "twingle_project_payment_methods" => [ + "custom_group_id" => "Twingle_Project_Payment_Methods", + "label" => E::ts("Payment Methods"), + "name" => "twingle_project_payment_methods", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Multi-Select", + "option_values" => [ + "has_paypal" => E::ts("PayPal"), + "has_banktransfer" => E::ts("Banktransfer"), + "has_debit" => E::ts("Debit"), + "has_sofortueberweisung" => E::ts("Sofortüberweisung") + ], + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 45, + "help_post" => E::ts("Chose which payment methods should be available. NOTE: You might have to activate them first in the Twingle-Manager configuration.") + ], + "twingle_project_payment_methods_recurring" => [ + "custom_group_id" => "Twingle_Project_Payment_Methods", + "label" => E::ts("Recurring Payment Methods"), + "name" => "twingle_project_payment_methods_recurring", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Multi-Select", + "option_values" => [ + "has_paypal_recurring" => E::ts("PayPal"), + "has_debit_recurring" => E::ts("Debit") + ], + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 45, + "help_post" => E::ts("Display a list of public donations") + ], + "twingle_event_id" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Twingle Event ID"), + "name" => "twingle_event_id", + "is_required" => TRUE, + "is_searchable" => TRUE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 16, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 1 + ], + "twingle_event_project_id" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Twingle Project ID"), + "name" => "twingle_event_project_id", + "is_required" => FALSE, + "is_searchable" => TRUE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 16, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 2 + ], + "twingle_event_identifier" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Identifier"), + "name" => "twingle_event_identifier", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 16, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 3 + ], + "twingle_event_contact" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Initiator"), + "name" => "twingle_event_contact", + "is_required" => FALSE, + "is_searchable" => TRUE, + "data_type" => "ContactReference", + "html_type" => "Autocomplete-Select", + "is_active" => TRUE, + "is_view" => FALSE, + "weight" => 5 + ], + "twingle_event_user_email" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Initiator Email"), + "name" => "twingle_event_user_email", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 128, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 6 + ], + "twingle_event_is_public" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Is public"), + "name" => "twingle_event_is_public", + "is_required" => FALSE, + "is_searchable" => TRUE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 7 + ], + "twingle_event_deleted" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Deleted"), + "name" => "twingle_event_deleted", + "is_required" => FALSE, + "is_searchable" => TRUE, + "data_type" => "Boolean", + "html_type" => "Radio", + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 8 + ], + "twingle_event_confirmed_at" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Confirmed At"), + "name" => "twingle_event_confirmed_at", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 64, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 9 + ], + "twingle_event_created_at" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Created At"), + "name" => "twingle_event_created_at", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 64, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 10 + ], + "twingle_event_creation_url" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Creation URL"), + "name" => "twingle_event_creation_url", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 256, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 11 + ], + "twingle_event_url_internal" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Internal URL"), + "name" => "twingle_event_url_internal", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 256, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 12 + ], + "twingle_event_url_external" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("External URL"), + "name" => "twingle_event_url_external", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 256, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 13 + ], + "twingle_event_url_edit_internal" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Edit Internal URL"), + "name" => "twingle_event_url_edit_internal", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 256, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 14 + ], + "twingle_event_url_edit_external" => [ + "custom_group_id" => "Twingle_Event_Information", + "label" => E::ts("Edit External URL"), + "name" => "twingle_event_url_edit_external", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 256, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 15 + ], + "twingle_campaign_parent_project_id" => [ + "custom_group_id" => "Twingle_Campaign_Information", + "label" => E::ts("Parent TwingleProject ID"), + "name" => "twingle_campaign_parent_project_id", + "is_required" => FALSE, + "is_searchable" => TRUE, + "data_type" => "String", + "html_type" => "Text", + "text_length" => 16, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 1 + ], + "twingle_campaign_cid" => [ + "custom_group_id" => "Twingle_Campaign_Information", + "label" => E::ts("CID"), + "name" => "twingle_campaign_cid", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "Text", + "text_length" => 32, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 2 + ], + "twingle_campaign_url" => [ + "custom_group_id" => "Twingle_Campaign_Information", + "label" => E::ts("URL"), + "name" => "twingle_campaign_url", + "is_required" => FALSE, + "is_searchable" => FALSE, + "data_type" => "Memo", + "html_type" => "TextArea", + "text_length" => 600, + "is_active" => TRUE, + "is_view" => TRUE, + "weight" => 3 + ] + ] +]; + diff --git a/CRM/TwingleCampaign/resources/dictionary.json b/CRM/TwingleCampaign/resources/dictionary.json deleted file mode 100644 index 150deff..0000000 --- a/CRM/TwingleCampaign/resources/dictionary.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "TwingleProject": { - "name": "title", - "last_update": "last_modified_date", - "project_target": "goal_revenue" - }, - "TwingleEvent": { - "description": "title", - "updated_at": "last_modified_date", - "created_at": "start_date", - "target": "goal_revenue" - } -} \ No newline at end of file diff --git a/CRM/TwingleCampaign/resources/dictionary.php b/CRM/TwingleCampaign/resources/dictionary.php new file mode 100644 index 0000000..e3a909c --- /dev/null +++ b/CRM/TwingleCampaign/resources/dictionary.php @@ -0,0 +1,18 @@ + [ + "name" => "title", + "last_update" => "last_modified_date", + "project_target" => "goal_revenue", + "counter-url" => "counter", + "embed" => "embed_codes" + ], + "TwingleEvent" => [ + "description" => "title", + "updated_at" => "last_modified_date", + "created_at" => "start_date", + "target" => "goal_revenue" + ] +]; + diff --git a/CRM/TwingleCampaign/resources/option_values.json b/CRM/TwingleCampaign/resources/option_values.json deleted file mode 100644 index 03b6564..0000000 --- a/CRM/TwingleCampaign/resources/option_values.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "twingle_event_donation": { - "name": "twingle_event_donation", - "label": "Twingle Event", - "description": "A soft credit type for TwingleEvent initiators.", - "option_group_id": "soft_credit_type" - } -} \ No newline at end of file diff --git a/CRM/TwingleCampaign/resources/option_values.php b/CRM/TwingleCampaign/resources/option_values.php new file mode 100644 index 0000000..c4a25d5 --- /dev/null +++ b/CRM/TwingleCampaign/resources/option_values.php @@ -0,0 +1,10 @@ + [ + "name" => "twingle_event_donation", + "label" => "Twingle Event", + "description" => "A soft credit type for TwingleEvent initiators.", + "option_group_id" => "soft_credit_type" + ] +]; diff --git a/CRM/TwingleCampaign/resources/twingle_api_templates.json b/CRM/TwingleCampaign/resources/twingle_api_templates.json deleted file mode 100644 index de6b202..0000000 --- a/CRM/TwingleCampaign/resources/twingle_api_templates.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "TwingleProject": [ - "id", - "identifier", - "allow_more", - "name", - "organisation_id", - "project_target", - "transaction_type", - "type", - "last_update", - "url" - ], - "project_embed_data": [ - "page", - "widget", - "form", - "form-single", - "widget-single", - "eventall", - "eventlist", - "counter" - ], - "TwingleEvent": [ - "id", - "project_id", - "identifier", - "description", - "user_name", - "user_email", - "is_public", - "deleted", - "confirmed_at", - "created_at", - "updated_at", - "target", - "creation_url", - "show_internal", - "show_external", - "edit_internal", - "edit_external", - "urls" - ], - "event_embed_data": [ - "page", - "eventpage", - "widget", - "form", - "widget-single", - "form-single", - "eventall", - "eventlist", - "eventeditcreate" - ], - "TwingleCampaign": [ - "id", - "parent_id", - "name", - "title" - ] -} \ No newline at end of file diff --git a/CRM/TwingleCampaign/resources/twingle_api_templates.php b/CRM/TwingleCampaign/resources/twingle_api_templates.php new file mode 100644 index 0000000..8e28c4f --- /dev/null +++ b/CRM/TwingleCampaign/resources/twingle_api_templates.php @@ -0,0 +1,114 @@ + [ + "project_data" => [ + "id", + "identifier", + "allow_more", + "name", + "organisation_id", + "project_target", + "transaction_type", + "type", + "last_update", + "url" + ], + "project_embed_data" => [ + "page", + "widget", + "form", + "form-single", + "widget-single", + "eventall", + "eventlist", + "counter" + ], + "project_options" => [ + "has_confirmation_mail", + "has_donation_receipt", + "has_contact_data", + "donation_rhythm", + "default_rhythm", + "has_newsletter_registration", + "has_postinfo_registration", + "design_background_color", + "design_primary_color", + "design_font_color", + "bcc_email_address", + "donation_value_min", + "donation_value_max", + "donation_value_default", + "contact_fields", + "exclude_contact_fields", + "mandatory_contact_fields", + "custom_css", + "share_url", + "has_contact_mandatory", + "has_doi", + "has_force_donation_target_buttons", + "slidericon", + "has_hidden_logo", + "has_projecttarget_as_money", + "has_donationtarget_textfield", + "has_civi_crm_activated", + "has_step_index", + "languages", + "has_buttons", + "has_no_slider", + "buttons", + "has_newsletter_namerequest", + "has_show_donator_data" + ], + "payment_methods" => [ + "has_paypal", + "has_banktransfer", + "has_debit", + "has_sofortueberweisung", + "has_paypal_recurring", + "has_debit_recurring" + ] + ], + "TwingleEvent" => [ + "event_data" => [ + "id", + "project_id", + "identifier", + "description", + "user_name", + "user_email", + "is_public", + "deleted", + "confirmed_at", + "created_at", + "updated_at", + "target", + "creation_url", + "show_internal", + "show_external", + "edit_internal", + "edit_external", + "urls" + ], + "event_embed_data" => [ + "page", + "eventpage", + "widget", + "form", + "widget-single", + "form-single", + "eventall", + "eventlist", + "eventeditcreate" + ] + ], + "TwingleCampaign" => [ + "campaign_data" => [ + "id", + "parent_id", + "name", + "title" + ] + ] +]; + diff --git a/api/v3/TwingleCampaign/Get.php b/api/v3/TwingleCampaign/Get.php index dce6b3a..6897ef0 100644 --- a/api/v3/TwingleCampaign/Get.php +++ b/api/v3/TwingleCampaign/Get.php @@ -105,7 +105,7 @@ function civicrm_api3_twingle_campaign_Get(array $params): array { // Get campaign type id for TwingleCampaign $twingle_campaign_campaign_type_id = Cache::getInstance() - ->getCampaigns()['campaign_types']['twingle_campaign']['id']; + ->getCampaignIds()['campaign_types']['twingle_campaign']['id']; // If no id but a project_id is provided, get all TwingleCampaign children of // this TwingleProject diff --git a/twinglecampaign.php b/twinglecampaign.php index 72558e1..ef73167 100644 --- a/twinglecampaign.php +++ b/twinglecampaign.php @@ -173,17 +173,17 @@ function twinglecampaign_postSave_campaign_callback ( try { civicrm_api3('TwingleProject', 'sync', ['id' => $campaign_id]); CRM_Utils_System::setUFMessage('TwingleProject was saved.'); - } catch (CiviCRM_API3_Exception $e) { - Civi::log()->error( - 'twinglecampaign_postSave_callback ' . $e->getMessage() - ); - } - } else { - try { - civicrm_api3('TwingleCampaign', 'create', ['id' => $campaign_id]); - CRM_Utils_System::setUFMessage('TwingleCampaign was saved.'); - } catch (CiviCRM_API3_Exception $e) { - Civi::log()->error( + +function _get_campaign_type_id_twingle_project() { + return ExtensionCache::getInstance() + ->getCampaignIds()['campaign_types']['twingle_project']['id']; +} + +function _get_campaign_type_id_twingle_campaign() { + return ExtensionCache::getInstance() + ->getCampaignIds()['campaign_types']['twingle_campaign']['id']; +} + 'twinglecampaign_postSave_callback ' . $e->getMessage() ); }