Skip to content
Advertisement

Tag: drupal

Turning a CSV into a nested JSON object in PHP, Drupal 8

I’m trying to turn a CSV into a JSON object made of nested arrays for each row within the file. I’ve tried a handful of similar SO questions but haven’t found quite the right solution. I’m attempting to set up a JSON object with a handful of nested objects, based on the first value in each row of the CSV.

PHP with Kafka – rdkafka

Iam dealing with kafka and php, Im beginner the kafka has been set upped correctly on the server, now am on local I have installed: librdkafka.dll on xamp/php and php_rdkafka.dll on xamp/php/ext and i added this on php.ini: extension=php_rdkafka.dll then, i have created a php page contains this code: Answer Are you trying to connect to confluent cloud? I would

How to access to node fields in drupal 8

I’m having some issues, I’m loading some nodes and i want to get some values field, this is how is my field I’m loading my nodes like this: But i dont know how to get en fr and pt fields values Could you please help me? Regards Mario Answer You can load translation for each language then get corresponding field’s

Sum up the array values

I am working on a custom module in drupal and need to sum up the [value], However I tried different approaches using array_column, array_sum, but didn’t get the solution. Any help would be appreciated. Thanks. Code Answer You could make use of array_map here instead of an accumulator: Edit, as a full example:

Error: Undefined class constant ‘MYSQL_ATTR_USE_BUFFERED_QUERY’

Currently I’m getting this kind of message and I don’t know how to fix it. The command php -m tells me that PDO and pdo_mysql are there. I’m using Drupal-8 with php7.1.20 on Ubuntu 18.04.1 LTS [Tue Sep 04 09:27:48.210064 2018] [php7:notice] [pid 2183] [client 10.56.99.1:53758] Error: Undefined class constant ‘MYSQL_ATTR_USE_BUFFERED_QUERY’ in /var/www/dev/web/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php on line 134 #0 /var/www/dev/web/core/lib/Drupal/Core/Database/Database.php(376): DrupalCoreDatabaseDrivermysqlConnection::open(Array)n#1 /var/www/dev/web/core/lib/Drupal/Core/Database/Database.php(166):

Invalid Run Id After running drupal page using XHProf

I have installed the Drupal XHProf 7.x-1.0-beta2 module and enabled it on the Modules page of my site. I have turned enabled the use of the module at Configuration -> Development -> XHProf settings (/admin/config/development/xhprof) by checking ON ” Enable profiling of all page views and drush requests. ” Now what? When I visit a page and click “XHProf output”

Advertisement