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

  • First page « First
  • Previous page ‹‹
  • Page 1
  • Page 2
  • Current page 3

Display a form in a block or controller drupal

Most often we may want to show our custom forms in blocks. Here are the simple steps to accomplish this.

In the below code we will create a form called “MymoduleExampleForm” and this form will be placed in a custom block called “MymoduleExampleBlock”.

Step 1 – Create a custom module say 'mymodule'. For details on how to create a custom module in Drupal 

Step 2 – Create a php file named MymoduleForm.php in mymodule/src/Form and place the following code.

Blog IT Blog IT
4 years 8 months ago
Read More

Disable a block for a specific page drupal

Drupal offers a mechanism in the backoffice to control the display of blocks, but it is sometimes necessary to set up a little more complex logic.

Here we are going to hide the "id_block" block from the "header" region when we are on an "article" type node via the HOOK_preprocess_page hook:

Blog IT Blog IT
4 years 9 months ago
Read More

Display a block drupal programmatically

Content blocks are blocks that you create in the interface. They are much like nodes configurable data structures, with fields etc. If you want to render one of these, you can do what you would normally do with entities, load them and render them with the view builder:

Blog IT Blog IT
5 years 4 months ago
Read More

Pagination

  • First page « First
  • Previous page ‹‹
  • Page 1
  • Page 2
  • Current page 3

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