Though ideally if we use the views correctly and override them well, Drupal Views itself take care of getting the translated version as per configurations of the view. For details check this: EntityField::getValue
Notes
Most of us know, the ideal way of making a variable available in a specific twig file is to use hook_preprocess_HOOK. But what if we have a requirement that we need a kind of global variable that should be accessible in any twig file. So, that we are able to use it wherever we want to, without additional pain.
The best part of Drupal is, everything is possible. But at the same time, there is a trick, you always have more than one way of doing things. And now it's in your hands to pick up the best suitable performant way for your solution.
Tags
Contains data structures and algorithms implementation in Javascript Language.
Based on https://www.geeksforgeeks.org/
Algorithms:
Searching Algorithms
- Binary Search
- Exponential Search
- Interpolation Search
- Jump Search
- Linear Search
- Recursive Substring Search
- Recursive Linear Search
- Sublist Search
Sorting Algorithms
- Bubble Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- Recursive Bubble Sort
- Selection Sort
No one wants to waste time on unnecessary things, especially a developer. If you frequently use a command on your terminal/command line, I would recommend creating a command alias to save some seconds (I guess).
I would make it quick, let's assume you want to navigate to some directory from anywhere and you want to avoid typing cd .... bla bla bla bla. So, let's make the alias for this.
Open the terminal and edit the .bash_profile
sudo nano ~/.bash_profile
Add the following line in the file
alias ms='cd ~/Sites/my_site'
Tags
I was working on issue queue of views extras module and came across a requirement: Add twig support: https://www.drupal.org/project/views_extras/issues/2948514. For a moment I was helpless, I mean I always had the requirement to use PHP function in twig but never thought in the reverse direction and to resolve that issue I need to know how we can support twig variables in PHP.
Service-based architecture is one of the major strength of Drupal 8. Drupal core and contrib provide lots of services to be used by other services, plugins or any other function. The flexible nature of Drupal allows overriding of services.
We can have different scenarios:
Tags
I came across a problem where I had the requirement that I need to continuously parse some information from some source and after checking some conditions I had to continuously render data at Browser end. So, I tried to do a POC around this in PHP and after few google searches around this I came up with the following piece of code:
Tags
Problem Statement: Recently, in my project, I came across a situation where on a webform submit by the authenticated user I had to send mail based on a configured variable. So, the condition was if variable is set to value 1 mail should be sent to site admin, else if it is configured 2 mail should be sent to the users which were referenced from the current user via field (say field_user_references) and tricky part if user field (field_user_references) is empty, mail should go to the site admin only.
Tags
Basic Programming Skills
-
Call by reference
-
Call by value
-
Recursion
-
Programs on Recursion (Factorial, Sum of n natural numbers)
-
Programs on string (Palindrome checking)
OOP - Skills
-
Access Modifiers
-
Abstract Classes
-
Interface
-
Static
-
Scope Resolution Operator
-
this