Logo MutantMahesh
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • Posts
  • Drupal
  • Python
  • Tips and Tricks
Hero Image
How to write custom menu link tree manipulator

In this post, I will show you how to write custom menu link tree manipulator. In Drupal 9/10, we can write a custom menu link tree manipulator. For example, If you want to load the menu link tree sorted. The Drupal core provides the \Drupal\Core\Menu\DefaultMenuLinkTreeManipulators::generateIndexAndSort. This manipulator loads the sorted menu link tree as nested array but the keys of array also have the index. In this blog I am going to write a custom manipulator that will return the menu link tree sorted by menu link weight and maintain the array key as menu link plugin id.

December 20, 2023 Read
Hero Image
How to fix import error with current package relative import

Problem ImportError: attempted relative import with no known parent package If you are developing a python package and try to import a module from the current package using relative path, you may get the following error. from .docdb_json_importer import DocDbJsonImporter OR from . import utils ImportError: attempted relative import with no known parent package For example in my case I was developing a package called docdb-import-export and I was trying to import a module from the current package using relative path like this:

September 5, 2023 Read
Hero Image
How to write custom views filter plugin to filter based on user zipcode

In this post, I will show you how to write custom views filter plugin to filter based on user zipcode. Just code no BS

May 24, 2023 Read
Hero Image
How to write custom access check for any entity

In this post, I will show you how to write custom access check for any entity, which can check more than user permission and role. In Drupal 8/9, we can write custom access check for any entity, which can check more than user permission and role. For example, we can check if the user is the author of the node or not. If the user is the author of the node, then we can allow the user to edit the node.

April 13, 2023 Read
Hero Image
How to restore tmux lost session

Tmux is a terminal multiplexer that allows users to create multiple sessions, panes, and windows within a single terminal window. It is an excellent tool for developers and system administrators who often work with multiple terminal sessions at once. However, sometimes users may face a situation where their tmux session gets lost due to system restart, terminal crash, or any other reason. In this blog post, we will discuss how to restore a lost tmux session.

April 10, 2023 Read
Navigation
  • About
  • Skills
  • Experiences
  • Education
  • Recent Posts
Contact me:
  • msankhala
  • Mahesh Sankhala

© 2023 Copyright.