Open main menu

Changes

4,590 bytes added ,  00:13, 29 October 2015
adds intro, Call Stack section, and tokens table
This article is a detailed walkthrough of debugging CiviCRM on Drupal (using NetBeans and XDebug). We're specifically debugging the behavior of token replacement and UI representation in the CiviMail component. We've found that if you create 'multi value' custom data that the tokens are not replaced. We're trying to fix that but we're not sure by just reading the code where the problem lies. Hopefully the debugger will provide enough inspection capability to see exactly what's going on; and by extension, what's going wrong.  == Call Stacks ==The overall process of request routing (Drupal menu system), data retrieval, content creation and output is intricate. It gets even more complex when you look at the internals of CiviCRM.
Since CiviCRM is a Drupal contrib module, a typical request has a call stack like this:
index.php.{main}:21
</pre>
 
{{highlight|
|text=Pro tip: You can Ctrl+click on all the line items in the Call Stack window of NetBeans. Then press Ctrl+C to copy the text, and paste it into your doc}}
 
Clicking the "Preview as HTML" button from the compose screen of a draft mailing has a call stack like the following. Note that a breakpoint is set at '''line 536''' where <source lang=php inline>$details = CRM_Utils_Token::getTokenDetails($mailingParams, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens());</source>
<pre>
sites/all/modules/contrib/civicrm/api/v3/Mailing.php.civicrm_api3_mailing_preview:536
sites/all/modules/contrib/civicrm/Civi/API/Provider/MagicFunctionProvider.php.Civi\API\Provider\MagicFunctionProvider->invoke:89
sites/all/modules/contrib/civicrm/Civi/API/Kernel.php.Civi\API\Kernel->run:96
sites/all/modules/contrib/civicrm/Civi/API/Subscriber/ChainSubscriber.php.Civi\API\Subscriber\ChainSubscriber->callNestedApi:196
sites/all/modules/contrib/civicrm/Civi/API/Subscriber/ChainSubscriber.php.Civi\API\Subscriber\ChainSubscriber->onApiRespond:72
sites/all/modules/contrib/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php.call_user_func:{/var/www/equality-tech.com/www/drupal/sites/all/modules/contrib/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164}:164
sites/all/modules/contrib/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php.Symfony\Component\EventDispatcher\EventDispatcher->doDispatch:164
sites/all/modules/contrib/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php.Symfony\Component\EventDispatcher\EventDispatcher->dispatch:53
sites/all/modules/contrib/civicrm/Civi/API/Kernel.php.Civi\API\Kernel->respond:221
sites/all/modules/contrib/civicrm/Civi/API/Kernel.php.Civi\API\Kernel->run:98
sites/all/modules/contrib/civicrm/api/api.php.civicrm_api:23
sites/all/modules/contrib/civicrm/CRM/Utils/REST.php.CRM_Utils_REST::process:404
sites/all/modules/contrib/civicrm/CRM/Utils/REST.php.CRM_Utils_REST::ajax:640
sites/all/modules/contrib/civicrm/CRM/Core/Invoke.php.call_user_func:{/var/www/equality-tech.com/www/drupal/sites/all/modules/contrib/civicrm/CRM/Core/Invoke.php:278}:278
sites/all/modules/contrib/civicrm/CRM/Core/Invoke.php.CRM_Core_Invoke::runItem:278
sites/all/modules/contrib/civicrm/CRM/Core/Invoke.php.CRM_Core_Invoke::_invoke:86
sites/all/modules/contrib/civicrm/CRM/Core/Invoke.php.CRM_Core_Invoke::invoke:54
sites/all/modules/contrib/civicrm/drupal/civicrm.module.civicrm_invoke:489
includes/menu.inc.call_user_func_array:{/var/www/equality-tech.com/www/drupal/includes/menu.inc:519}:519
includes/menu.inc.menu_execute_active_handler:519
</pre>
 
== Tokens Tested ==
{| class="wikitable"
|+ tokens tested
! token !! replaced !! $returnProperties !! multi
|-
| {contact.first_name} || yes || yes || no
|-
| {general.wUrl} || || no || yes
|-
| {custom_40} || || yes || yes
|-
| {contact.custom_40} || || no || yes
|-
| {general.custom_40} || || no || yes
|-
| {general.general.custom_40} || || no || yes
|-
| {contact.custom_71} || || yes* || yes?
|-
| {general.articlepath} || || no || yes
|-
| {general.base} || || no || yes
|-
| {general.favicon} || || no || yes
|-
| {general.logo} || || no || yes
|-
| {general.generator} || || no || yes
|-
| {stats.activeusers} || || no || yes
|-
| {stats.admins} || || no || yes
|-
| {stats.images} || || no || yes
|-
| {stats.pages} || || no || yes
|-
| {stats.wUrl} || || no || yes
|-
| {contact.custom_72} || || ? || no?
|-
| {custom_72} || || yes || no?
|}
 
4,558

edits