The problem: HTML elements have inconsistent sizes across different browsers.
The solution: Set box-sizing for all elements to border-box.
A long-time bane for web developers, Internet Explorer did one thing right: It sized boxes properly.
Other browsers only look at the content when calculating the width of an HTML element, with everything else treated as surplus. A width: 200px div, with 20px padding and a 2px border, renders as 242 pixels wide.
Technical Blog
During these times of hardship where COVID19 is on one side, the near-recession is looming on the other. Businesses have taken a hit with minimal demand. Even though more and more people are adapting to the “digital lifestyle” and are spending more time online, the revenues are nowhere nearer to what they used to be. Brands have cut down on ad spends and E-commerce is not doing any sales due to the supply chain situation.
Drupal is one of the most secure Web Content Management systems available today and the credit for this goes to the simple fact that there is a dedicated security team that constantly checks the codebase for any vulnerabilities and provides fixes for any vulnerabilities identified.
As per the Drupal Security team, security release "windows" are every Wednesday for Drupal contributed projects, and one Wednesday a month (usually the third Wednesday) for Drupal core.
What are Pseudo-Fields?
Pseudo field is a field that you can add to any content entity type. For example, you can add a pseudo-field to nodes, taxonomy terms, users, paragraphs, etc. You can hide this field in the UI, but you cannot change it's value, because the content of this field is generated via the code.
Slick view
Slick view is a module which provides new display style to views called Slick Carousel. For this, ‘Views UI’ module is not required. If we need to customize slick slider then we can use Views UI.
Installation
Slick views: Composer requires drupal/slick_views
This will install
lick carousel has many features. Responsiveness is the main feature, that is the ability to scale according to its container. It provides advanced settings for breakpoints. The slick slider can be scrolled using the auto scroll, mouse wheel scroll, swipe, desktop mouse dragging etc. It provides settings for customizing arrow keys and its navigation also provides settings for dots under the slider for slide selecting. Slick has different skins like Full width, Full-screen Split, Grid and multiple-row carousel.
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.
I had a requirement to add a multi-level responsive drop down menu in a Zyxware theme. Please do refer the below reference links to know more about responsive themes and free Drupal themes. So for that I had to edit page.tpl.php, page--front.tpl.php, style.css, template.php etc.
First I added the following code to template.php of my theme. The steps that I followed here are,
In Drupal 8, the usage of database operations such as select, update and delete are slightly changed from Drupal 7. The db_query() is deprecated in Drupal 8. To fetch a field we can use :
$query = \Drupal::database()->query('SELECT myfield from my_table where
field1 = :value1 AND field2 = :value2', array(
':value1' => $condition1,
':value2' => $condition2,
)
);
$data = $query->fetchField();
Now we can checkout the select, update, and delete operations in Drupal 8. For a field selection use,
For upgrading any of your contributed Drupal 7 modules, you just need to follow the few steps shown below. First of all you have to make sure that Drush is installed. If not installed, follow the steps from here.
For one of my project, I have implemented the Redis module in Drupal 8. I have used the following configurations as follows:
In Drupal, usually the date field value is saved in the database in UTC timezone format. One of our requirements for a project was to show the date in the site's timezone format. So we generated a general function to convert date in UTC timezone to any required timezone and format it.
Just use the below function to convert date in UTC timzone to a given timezone and the format date using a valid timestamp,
As part of a project requirement, we needed to notify users whenever an entity got created, updated, rated, or reviewed. Drupal's 'message' module fulfills this requirement.
We can log and display messages and can even customize the notifier plugins. For creating a notification, we need to install the following modules:
message
message_notify
message_subscribe
The dependent modules are:
Have you been trying to index your node to Apache immediately after its been created, updated or deleted! Read On!!
By default Apache Solr uses a queue system to index data to Solr. We can preconfigure the interval in which the indexing should perform. Still, there occurs a delay for the node to get indexed.
It is high time to make your website GDPR compliant, as the regulation is going to be effective from May 25th, 2018. If you would like to revisit our article on what GDPR is and how it can affect a site owner or developer, you can read our previous article here.What do you have to do to comply with GDPR?Now that you know what GDPR is and what it is about, here are the steps to follow to be compliant with GDPR.
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 8 See here
Step 2 – Create a php file named MymoduleExampleForm.php in mymodule/src/Form and place the following code.
In Drupal 8 we can load an image using image style in a custom function using the file id of the image. For this first, we have to create an image style by configuration or create a config file for the same (Example below: image.style.sample_image_style.yml). Note that we can generate the below file after creating an image style and export the same from config synchronization in Drupal 8.
Patternlab is a dynamic organizational and prototyping tool for Drupal theming. By theming with pattern lab, your custom theme allows us to manage and build components in accordance with the required workflow using atomic design concepts1.
Using Pattern Lab for Drupal 8 Theming
Instead of rendering default Drupal templates, we can introduce pattern lab to include twig files using atomic concepts. It allows us to include external twig files by overriding the specific templates.
Kraftwagen is an Open Source deployment tool that is built entirely on top of Drush. Kraftwagen makes Drupal “easy to use” for developers, who customize Drupal extensively, need staged deployments, and use version control systems to collaborate. It provides a set of commands for 'drush make' based Drupal development workflow.Benefits of using Kraftwagen for security updates
By using Kraftwagen to deploy security updates, the benefits are multifold, which include
In one of my work, there was a requirement to uncheck the option for 'Generate automatic url alias' checkbox for all nodes. I used the Pathauto module with version 7.x-1.2 for handling standard urls in the site. When changing a node title, its URL automatically changes. In case one forgets to uncheck the option 'Generate automatic url alias' in the node editing form, you can uncheck the option with the following steps: