Skip to content

Instantly share code, notes, and snippets.

@RuZniki
RuZniki / kint.module.php
Last active March 28, 2017 09:22
Drupal 8 Kint how to modify maxLevels
<?php
/**
* Change function kint in devel/kint/kint.module
*
* Show $var up to level 6
* kint($var, ['kint_maxLevels' => 6]),
*/
function kint() {
kint_require();
if (\Drupal::currentUser()->hasPermission('access kint')) {
@RuZniki
RuZniki / drupal-8.form.reset-button.php
Last active November 10, 2023 09:39
Drupal 8 Adding a Reset Button to a form
<?php
/**
* Implements template_preprocess_form().
*/
function TEMPLATE_preprocess_form(&$vars) {
$vars['form']['actions']['reset'] = [
'#type' => 'html_tag',
'#tag' => 'input',
'#attributes' => [
'class' => 'button',
@RuZniki
RuZniki / HOOK_search_api_solr_query_alter.php
Created December 28, 2016 15:52
Оператор между для search_api_solr
<?php
/**
* Implements hook_search_api_solr_query_alter()
*
* В SearchApiSolrService::createFilterQuery Нету оператора "между".
* При использовании facetapi ranges с multivalued полями, возникают проблемы.
* @see https://www.drupal.org/node/1783746#comment-11813009
* Чтобы не хачить сразу кучу модулей, мы добавим костыль сюда.
* Если пользователь в запросе выбрал наш фасет, то мы удаляем значения фильтра,
* которые используют этот же фасет и вставляем наш фильтр вида [40 от 50].
@RuZniki
RuZniki / responsive-screens.js
Last active October 16, 2016 13:39 — forked from ryanmark/responsive-screens.js
Easy responsive screenshots with Phantom.js
/*
* Take a set of full height screenshots for a range of screensizes.
* phantomjs responsive-screens.js http://www.cnn.com/ png
*
* This will create a directory tree in your current directory which
* mirrors the URL. All files will be named with the current time.
* You can run this on a cron to build an archive of screenshots.
**/
var page = new WebPage(),