developer resources
Codebales holds an ever growing number of solutions to problems that we have experienced in our day to day code writing
Selected filter
161
results
Andrew Fletcher
•
In drupal 9 for logging you can use logger service to log array data in some readable format, by adding html code and print_r to array.
\Drupal::logger('my_module')->warning('<pre><code>' . print_r($responseObj, TRUE) . '</code></pre>');
my_module is type of log message, warning is severity method you call and $responseObj is array you need to put to log file to have some formatting. Other options you can use include:
emergency($message,...
Andrew Fletcher
•
Adding Solr config zip (ie. solr_8.x_config.zip) to your remote...
Andrew Fletcher
•
Following is a series of steps to install Tika and have it running for your Solr...
Andrew Fletcher
•
Working on an Azure server I ran a mysqldump command to generate a copy of the...
Andrew Fletcher
•
When attempting to backup mysql using the mysqldump command
mysqldump -u root...
Andrew Fletcher
•
How to Create New MySQL User
Before you can create a new MySQL user, you need to open a terminal window and launch the MySQL shell as the root user. To do so, enter the following command:
sudo mysql –u root –por rather than typing sudo each time you can enter:
sudo su
mysql -u root -pIn either scenario next type in the root password and press Enter.
The prompt will change to
mysql>
Database list
Can you view the list of databases on the server using the following command:
SHOW...
Andrew Fletcher
•
You can create a new date/time format by navigating to:
Admin ->...
Andrew Fletcher
•
To assist in finding possible solutions some of the queries that I made...
Andrew Fletcher
•
Creating a message log using Drupal watchdog.
Simple log
// Logs a...
Andrew Fletcher
•
The generally accepted answer to a mysqldump is:
mysqldump -h [host] -u...
Andrew Fletcher
•
Working in Twig, I had to add classes to a pre-existing array. Whilst I've grown used to the patterns in PHP, these cannot be applied in Twig. Instead I had to merge the new array elements.
Non associative arrays
Working from a base level, I'll begin as if the original array hasn't been set. The merge filter expects as first argument an array whose content will be merged with the assigned variable:
{% set myArray = [] %}
{% set myArray = myArray|merge(['tw-flex-inline'])...
Andrew Fletcher
•
On a git pull from remote dev environment to a staging environment running off...
Andrew Fletcher
•
I was trying to create something quite simple. How to get image file uri...
Andrew Fletcher
•
I'm writing these steps primarily for myself as a reference. However, if...
Andrew Fletcher
•
Setting up a new project in Docker and VS Code.
Using Terminal, go to your...