Drupal 8 - How to hide a view block if content is empty
Introduction I have created a view, with some filters and content fields. I will…
March 18, 2018
Note: I have public URLs of these images, which I want to save.
return $imageFile; } function save_my_node($valueArray) { $node = new stdClass(); $node->title = $valueArray->title $node->type = ‘my_content_type’; node_object_prepare($node);
$node->language = LANGUAGE_NONE; $node->uid = 1; //see if you want to use another user, or logged in user $node->status = 1; $node->promote = 0; $node->comment = 1; //comments closed $node->sticky = 0;
$node->body[$node->language][0][‘value’] = $valueArray->description; $node->body[$node->language][0][‘format’] = filter_default_format(); $imageObj = _prepareImageObj($valueArray->imageUrl); if (!$imageObj) { return false; } $node->field_image[$node->language][0] = (array)$imageObj;
// Prepare node for saving if ($node = node_submit($node)) { node_save($node);
print "\nNode saved, nid: ".$node->nid . ", videoId: ".$youtube_doc['_id'];
} else { print ‘Error’; } }
You can customize this code for more robust error handling.
Enjoy.
Introduction I have created a view, with some filters and content fields. I will…
Introduction In Azure, assuming you are having a storage container. And, you…
You have drupal 7 image from docker hub, and want to connect tomongo db via php…
Introduction There are some cases, where I need another git repository while…
Problem Statement In a mysql table, I wanted to replace the hostname of the…
This post is dedicated for cases where we intend to append a variable value in a…
Introduction In this post we will see following: How to schedule a job on cron…
Introduction There are some cases, where I need another git repository while…
Introduction In this post, we will see how to fetch multiple credentials and…
Introduction I have an automation script, that I want to run on different…
Introduction I had to write a CICD system for one of our project. I had to…
Introduction Java log4j has many ways to initialize and append the desired…