Skip to main content
Blog IT Information technology

Main navigation

  • Home
  • Contact us

User account menu

  • Log in
  • Register

drupal

  1. Home
  2. Blogs
  3. Drupal

Pagination

  • Current page 1
  • Page 2
  • Page 3
  • Next page ››
  • Last page Last »

Key Differences Between Drupal 7 and Drupal 8+

Let’s break down some key differences between Drupal 7 and Drupal 8+:

 Templating Engine:

 Drupal 7: PHP Template 

Drupal 8+: Twig template engine (more secure and flexible!) 

 Programming Paradigm:

 Drupal 7: Traditional PHP 

Drupal 8+: Object-oriented programming with Symfony components for a modern architecture! 

 Configuration Management: 

Drupal 7: Lacks native configuration management 

Blog IT Blog IT
5 months ago
Read More

Drupal 8+ delete node using some criteria programmatically

Here are the two methods to delete the nodes in Drupal 8 programmatically.

1) Using NID

use Drupal\node\Entity\Node;

$nid = 123;
$node = Node::load($nid);
// or
$node = \Drupal::entityTypeManager()->getStorage('node')->load($nid);

// Check if node exists with the given nid.
if ($node) {
  $node->delete();
}

2) Using some criteria (for example, older than 90 days)

Blog IT Blog IT
1 year 3 months ago
Read More

Delete All nodes of specific content type programmatically drupal 8+

This is mainly for deleting all testing data that you may have created using devel generate module or similar to it

If you have devel php installed in your drupal site you can directly run this is the browser or you may have to use it in the custom module 

I would recommend to use devel php module as it is much simpler and easy to use just make sure you don't have devel modules in your production environment and if you need to delete nodes in the production then just install devel to run this code and then uninstall

 

Blog IT Blog IT
1 year 3 months ago
Read More

Multisite folder structure in Drupal 8+

Following is an example of the multisite structure with Drupal. For simplicity, other Drupal core folders and files are not listed.

Blog IT Blog IT
1 year 3 months ago
Read More

How to create a Media video youtube entity programmatically drupal 8+

The example above assumes that you have the video file ID. This could be the case when you are converting video fields to media. 

To do this you have to use the Remote video media type.

use Drupal\media\Entity\Media;

$video_media = Media::create([
  'bundle' => 'remote_video',
  'uid' => 1,
  'name' => 'DrupalCon Prague 2022 Driesnote',
   'field_media_oembed_video' => [
     'value' => 'https://www.youtube.com/watch?v=Hmit4ET-l3Q',
   ],
]);
$video_media->save();

 

Blog IT Blog IT
1 year 4 months ago
Read More

Create media image programmatically in Drupal 8+

Using Media in Drupal (versions 8+) is a much better option than using old-school image fields. You can add all types of fields to Media to enrich your images, videos, and other media types with additional information, and you can also reuse Media. All of that cannot be easily done if you are using regular image fields.

Just like Content types, you can have multiple different types of Media. By default when you enable the Media module you get the following types:

Blog IT Blog IT
1 year 4 months ago
Read More

How to Load Node, File, Taxonomy Entities by ID in Drupal 8+

To load node details using its id in Drupal 8+ uses the following syntax:

$node_details = Node::load($nid);
$node_details->field_FIELD_NAME->value;

We can load multiple nodes in Drupal 8+ using load multiple() function. Note that the parameter should be an array of ids.

Blog IT Blog IT
1 year 4 months ago
Read More

conditional form fields drupal programmatically

Drupal's Form API #states property allows to easily show or hide, enable or disable, require or collapse form fields based on values selected or entered in other fields on that form or anywhere else on the page.

Blog IT Blog IT
1 year 4 months ago
Read More

How to Add Dependency Injection in a Controller in Drupal 8+

Dependency Injection is a design pattern that helps decouple the different components of a software application. It is a software design pattern that helps to manage the dependencies between different components in a software system. It involves passing the required dependencies into a class, rather than letting the class create or locate them itself.

Blog IT Blog IT
1 year 6 months ago
Read More

Drupal Create Node Programmatically

Drupal is a content management system that allows you to create and manage website content in an organized way. One of the ways to create content in Drupal is by creating a node programmatically. A node is a fundamental building block of a Drupal website and represents a piece of content such as an article, a page, or a product.

To create a node programmatically in Drupal 8+, you will need to use the Drupal's Entity API, specifically the Node class. Here's an example of how you can create a basic node:

Web Developer Web Developer
1 year 6 months ago
Read More

Pagination

  • Current page 1
  • Page 2
  • Page 3
  • Next page ››
  • Last page Last »

Subscribe to the Newsletter

Blog Category

Web
Mobile
Security
Design

Tags keyword

html
css
php
Sass
html5
drupal
drupal 8
drupal 9
drupal 10
laravel
symfony
vue.js
vue
js
css3
jquery
javascript
image
table
iframe
link
mail
twig
drush
module
git
gitflow
web
drupal 7

Monthly archive

  • May 2018 (1)
  • May 2019 (1)
  • November 2019 (1)
  • December 2019 (1)
  • March 2020 (2)
  • May 2020 (3)
  • June 2020 (2)
  • July 2020 (3)
  • November 2020 (1)
  • December 2021 (3)
  • October 2022 (1)
  • November 2022 (7)
  • December 2022 (15)
  • February 2023 (1)
  • April 2023 (1)
  • May 2023 (2)
  • June 2023 (3)
  • July 2023 (4)
  • August 2023 (8)
  • September 2023 (3)
  • October 2023 (9)
  • November 2023 (5)
  • September 2024 (1)

Copyright © 2025 - Blog Information technology - Sitemap