Skip to content

Instantly share code, notes, and snippets.

View reddyweb's full-sized avatar
🎯
Focusing

Sudharshan reddyweb

🎯
Focusing
View GitHub Profile
@reddyweb
reddyweb / mysql.md
Last active April 25, 2019 12:06
find out which table has more records mysql

Find out number of records of all tables in MySQL datbase

SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'database_name' order by table_rows;
@reddyweb
reddyweb / CRON-Setup.md
Last active July 16, 2019 09:45
UNIX syntax for cron setup. Make sure that the entered time matches the time on the server - Coordinated Universal Time (UTC).

Fields order

 +---------------- minute (0 - 59)
 |  +------------- hour (0 - 23)
 |  |  +---------- day of month (1 - 31)
 |  |  |  +------- month (1 - 12)
 |  |  |  |  +---- day of week (0 - 6) (Sunday=0)
 |  |  |  |  |
 * * * * *
@reddyweb
reddyweb / development.services.yml
Created August 25, 2019 09:45
Drupal + Twig debug settings
# Local development services.
#
# To activate this feature, follow the instructions at the top of the
# 'example.settings.local.php' file, which sits next to this file.
parameters:
http.response.debug_cacheability_headers: true
twig.config:
debug: false
auto_reload: true
cache: false
@reddyweb
reddyweb / node.html.twig
Last active November 28, 2021 14:03
Drupal 9 Twig - Field Image Multivalue field with title and alt tags
{% for key, item in node.field_image.value %}
<img src="{{ file_url(content.field_image[key]['#item'].entity.uri.value) }}" alt="{{ item.alt }}" title="{{ item.title }}" />
{# or #}
{{ content.field_image[key] }}
{% endfor %}
@reddyweb
reddyweb / using_limit_validation_errors.php
Created April 5, 2022 09:07 — forked from anxp/using_limit_validation_errors.php
How to correctly use #limit_validation_errors element of Form API in Drupal 7
<?php
//Sometimes we need to submit only part of the form. Sure, if form has #required fields, all they will be highlighted with red,
//and form will not be submitted if these elements have no value.
//To workaround this, we can use '#limit_validation_errors' option AND custom submit function for every 'Partial Submit' button.
//Interesting note: when we use '#limit_validation_errors', we will see ALL form fields in _validate function,
//but in _submit function will be visible ONLY elements, included in '#limit_validation_errors' array!!!
//Case 1. The most simple.
//We want to make a 'reset' button, or 'previous step' button, so it must work even if some REQUIRED form elements are empty: