Skip to main content
Blog IT Information technology

Main navigation

  • Home
  • Contact us

User account menu

  • Log in
  • Register

php

  1. Home
  2. Blogs
  3. Php

Pagination

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

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 5 months ago
Read More

Configure and Display a Schedule of Opening Hours in PHP

Opening Hours is a PHP package by Spatie to query and format a set of business operating hours. You can use it to present the times per day and include exceptions for things like holidays and other days off on a given year-specific date or recurring (happening each year). The project's readme file has this example to illustrate how you can configure hours:

Blog IT Blog IT
1 year 5 months ago
Read More

Building a Sitemap in your Laravel app with the Spatie Sitemap

According to Google, most sites would benefit from a sitemap, which helps bots know what pages should be crawled.

A sitemap is a file where you provide information about the pages, videos, and other files on your site, and the relationships between them. Search engines like Google read this file to crawl your site more efficiently. A sitemap tells Google which pages and files you think are important in your site, and also provides valuable information about these files. For example, when the page was last updated and any alternate language versions of the page.

Blog IT Blog IT
1 year 5 months ago
Read More

How to Increase PHP Memory Limits

Why are PHP memory limits important to your website development journey? PHP is a famous backend technology that is used by many tech giants for supporting their applications. PHP gives many advanced features for making web pages dynamic and integrating some features you can not simply get using javascript, HTML, and CSS.

Blog IT Blog IT
1 year 5 months ago
Read More

install laravel 10 with composer

Laravel is a web application framework with expressive, elegant syntax. A web framework provides a structure and starting point for creating your application, allowing you to focus on creating something amazing while we sweat the details.

Laravel strives to provide an amazing developer experience while providing powerful features such as thorough dependency injection, an expressive database abstraction layer, queues and scheduled jobs, unit and integration testing, and more.

Blog IT Blog IT
1 year 5 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 5 months ago
Read More

How can I convert Hijri date to gregorian in PHP?

I would like convert this date:09/13/1436 (it is Hijiri) to 2015-06-30(it is Gregorian). I tried that:

function HijriToJD($m, $d, $y){
   return (int)((11 * $y + 3) / 30) + 354 * $y + 
     30 * $m - (int)(($m - 1) / 2) + $d + 1948440 - 385;
}


$date = HijriToJD(9, 13, 1436);

echo jdtogregorian($date);

Blog IT Blog IT
1 year 5 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 7 months ago
Read More

Create a Taxonomy Term Programmatically in Drupal

We know Taxonomy is a powerful core module and helps us categorize the content. A vocabulary in Drupal is essentially a container for terms that are used by the system. These terms are what Drupal uses to connect certain areas together within the website.

Web Developer Web Developer
1 year 8 months ago
Read More

How do I create a role user drupal programmatically

How do I create a role programmatically in Drupal 8+

//your data array
$data = array('id' => 'client', 'label' => 'Client');
//creating your role
$role = \Drupal\user\Entity\Role::create($data);
//saving your role
$role->save();

In my case, I wanted to be able to auto-create multiple roles ("clients","managers","salesrep") to work with my custom module.

This is how I auto-create roles programmatically in Drupal.

Web Developer Web Developer
1 year 8 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