Skip to content

Instantly share code, notes, and snippets.

View woutersf's full-sized avatar

woutersf woutersf

View GitHub Profile
@woutersf
woutersf / drupal8_render_field_value_in_twig.twig.html
Created January 6, 2017 12:48
drupal8 render field value in twig
//render all content without a specific field
{{ content.without('field_name') }}
//render only one specific field
{{ content.field_audio_file }}
//render only one specific field's value
{{ content.field_audio_file.value }}
@woutersf
woutersf / drupal8 taxonomy_get_tree.php
Created January 16, 2017 13:58
drupal8 taxonomy_get_tree
<?php
$tree = \Drupal::service('entity_type.manager')
->getStorage("taxonomy_term")
->loadTree($vid, $parent = 0, $max_depth = NULL, $load_entities = FALSE));
@woutersf
woutersf / drupal8_table_with_render_array.php
Created January 16, 2017 15:55
drupal8 nested render array in table
<?php
$header = array();
foreach ($programs->list as $program) {
$rows[] = array(
'img' => array(
'data' => array(
'#theme' => 'image',
'#attributes' => array(
'src' => $program->images[0]->url, //Images come from an external resources, otherwise use #uri on the level of #attributes
)
@woutersf
woutersf / custom_drupal_bootstrap.php
Created January 28, 2017 10:09
custom drupal bootstrap (for performance)
<?php
if(empty($_GET['submithandler']) && empty($_POST['submithandler'])) {
http_response_code(400);
die('Invalid data');
}
define('DRUPAL_ROOT', $_SERVER['DOCUMENT_ROOT']);
require_once DRUPAL_ROOT. '/includes/bootstrap.inc';
require_once DRUPAL_ROOT. '/includes/common.inc';

Dropsolid Personalisation 1 on 1

Required

php working preferrably composer working too

Installation

Install drupal

mkdir drupal && cd drupal && curl -sSL https://www.drupal.org/download-latest/tar.gz | tar -xz --strip-components=1

@woutersf
woutersf / cloudinary_metadata_export.js
Last active October 5, 2023 10:44
Cloudinary export Metadata from FOLDER
/**
1. Make sure the exported file does not exist (archive.csv)
2. Replace the following with the correct information:
- THE_FOLDER_ON_THE_DAM
- MYCLOUDNAME_HERE
- MY_API_KEY_HERE
- MY_API_SECRET_HERE
3. npm install csv-writer and npm install cloudinary
4. Run with 'node cloudinary_metadata_export.js'