Code Snippet

By toswebdev, 18 April, 2023

Description

If you have an input field on your website with a font size of fewer than 16 pixels, Safari on iPhone considers the text too small to read and automatically zooms in on the form field when the user taps on it.

The behavior is intended but it can deteriorate the expected user experience so it might be a good idea to disable this functionality and keep the zoom static while filling form controls.

By toswebdev, 10 February, 2023

In many programming languages, == and === are used to compare values to determine whether they are equal. The difference between == and === depends on the programming language, but in general, == is used for equality comparison that performs type coercion, while === is used for strict equality comparison that does not perform type coercion.

By toswebdev, 3 January, 2023

What is confetti-falling animation? 

A confetti-falling animation effect is a visual display in which small pieces of paper or other material are made to fall or appear to fall from the top of a screen or display, simulating the effect of actual confetti falling. This type of animation can be used to add a festive or celebratory touch to a website, video, or other digital content.

By toswebdev, 5 October, 2022

I will show you how to add Twig Template Suggestions for Form Elements in Drupal 9
 

/**
 * @param array $suggestions
 * @param array $variables
 * @param $hook
 */
function mytheme_theme_suggestions_form_element_alter(array &$suggestions, array $variables, $hook)
{
  if (isset($variables['element']['#id'])) {
    $id = str_replace("-", "_", $variables['element']['#id']);
    $suggestions[] = $hook . '__' . $id;
  }
}

The result is as follows
 

By toswebdev, 27 January, 2022
<?php

use Drupal\Core\Access\AccessResult;
 
...
 
/**
 * Implements hook_entity_access().
 */
function drupalbook_examples_entity_access(\Drupal\Core\Entity\EntityInterface $entity, $operation, \Drupal\Core\Session\AccountInterface $account) {
  if ($entity->getEntityTypeId() == 'node' && $entity->getType() == 'article' && $operation == 'view' && in_array('administrator', $account->getRoles())) {
    AccessResult::forbidden();
  }
}

?>

There Main Three types AccessResult as Below