Drupal 8 logger example
\Drupal::logger('ipc_order_sync')->notice('Adding the following order to the enqueJob @order_id with transaction id of @transaction_id', [ '@order_id' => $order['order_id'], '@transaction_id' => $order['transaction_id'], ]);
\Drupal::logger('ipc_order_sync')->notice('Adding the following order to the enqueJob @order_id with transaction id of @transaction_id', [ '@order_id' => $order['order_id'], '@transaction_id' => $order['transaction_id'], ]);
In your settings.php:
$settings['foo'] = 'bar';
In your code:
use Drupal\Core\Site\Settings; Settings::get('foo', 'mydefaultvalue');
drupal advancedqueue:queue:process ipc_transaction_sync
or
drush advancedqueue:queue:process ipc_transaction_sync
or
drush advancedqueue:queue:process ipc_order_sync
https://stovepipe.systems/post/avoiding-static-in-your-code
If there are not dependencies and it's not a pain to mock in a unit test, or for re-use then static is fine. A service lets you encapsulate everything and all the dependencies using dependency injection, to make sure all the dependencies are easy to setup.
Temporary fix for:
The URI '' is invalid. You
must use a valid URI scheme. in
Drupal\Core\Url::fromUri() (line 290 of
/Users/jamesbarnett/sites/IPC/ipcedtr/
This is how I get around that issue locally….
docroot/core/lib/Drupal/Core/Url.php
Line:290
return static::fromUri('http://localhost');
These directions worked with some modifications: https://javorszky.co.uk/2018/05/03/getting-xdebug-working-on-php-7-2-an…
I was using PHP on the command line with homebrew, so installed xdebug with pecl install xdebug
then I was able to put the following in the php.ini file, find the php.ini file for the command line by running php --ini and look for Loaded Configuration File in the output.
The below is for XDEUG 3.0
$result = \Drupal::entityQuery('group') ->condition('type', $type) ->range(0, 20000) ->accessCheck(FALSE) ->execute();
make sure to set accessCheck to FALSE or you'll get no results, entityQuery respects permissions and the drush user won't be running as any particular user.
/** * Implements hook_mail(). */ function app_voucher_mail($key, &$message, $params) { $function = 'app_voucher_mail__' . $key; if (function_exists($function)) { return $function($key, $message, $params); } /* * @I Convert the enrollment email to use the new mail handler * type : improvement * priority : normal * labels : refactoring */ if (!empty($params['from'])) { $message['from'] = $params['from']; } $message['subject'] = $params['subject']; $message['body'][] = $params['body']; } /**
$link = Url::fromUri('internal:/dashboard/1/my-vouchers');
$params['message'] = t('Your voucher is about to expire. Click here to view and manage your list of vouchers %link', ['%link' => $link->toString()]);
Copy the config file(s) to a temp directory called only-few-configs (or whatver you like) and run drush cim --partial --source=/full/pathTo/only-few-configs/
This should have worked supposedly: drupal config:import:single --directory="/Users/jamesbarnett/sites/IPC/ipcedtr/config/default" --file="views.view.confirm_message_product_display.yml". (might need drupal console?)
It's working 10/3/2023 like this:
drush cim --partial --source="sites/default/files/config_2qxS84OiSm1EoIIcX3HFTV8-JsS8c-pks87NrsHJkFA0U2X6cg8C66i5u7klv3Iu2w76K2QSFw/sync"