Skip to content

Instantly share code, notes, and snippets.

View mecmartini's full-sized avatar

Marco Martino mecmartini

View GitHub Profile
diff --git a/config/schema/views_data_export.views.schema.yml b/config/schema/views_data_export.views.schema.yml
index 7fee9ea..f9c32a9 100644
--- a/config/schema/views_data_export.views.schema.yml
+++ b/config/schema/views_data_export.views.schema.yml
@@ -13,6 +13,21 @@ views.display.data_export:
filename:
type: string
label: 'Downloaded filename'
+ automatic_download:
+ type: boolean
@mecmartini
mecmartini / drupal-views-data-export-batch-operation-and-fix-export-format.patch
Created April 1, 2018 23:10
drupal-views-data-export-batch-operation-and-fix-export-format.patch
diff --git a/config/schema/views_data_export.views.schema.yml b/config/schema/views_data_export.views.schema.yml
index 7fee9ea..f9c32a9 100644
--- a/config/schema/views_data_export.views.schema.yml
+++ b/config/schema/views_data_export.views.schema.yml
@@ -13,6 +13,21 @@ views.display.data_export:
filename:
type: string
label: 'Downloaded filename'
+ automatic_download:
+ type: boolean
diff --git a/menu_token.module b/menu_token.module
index 6f0d91c..344fced 100644
--- a/menu_token.module
+++ b/menu_token.module
@@ -389,6 +389,9 @@ function replace_links_with_tokens(Token $token_service, $replace_with, $relevan
if (!empty($config_menu)) {
$configuration = unserialize($config_menu->configurationSerialized);
$links[$relevant_link['id']][$replace_with] = $token_service->replace($links[$relevant_link['id']][$replace_with], [], ["configuration" => $configuration], $bubbleableMetadata);
+ if (is_null($links[$relevant_link['id']][$replace_with])) {
+ $links[$relevant_link['id']][$replace_with] = $token_service->replace($config_menu->linkid, [], ["configuration" => $configuration], $bubbleableMetadata);
@mecmartini
mecmartini / your_theme_name.theme
Last active May 23, 2018 12:13
Drupal preprocess html to force all assets to https with hsts contrib module enabled
<?php
function your_theme_name_preprocess_html(&$variables) {
// You can remove this if and leave only it's content if you don't need it
// or the contrib module hsts is not enabled on your Drupal.
if (\Drupal::moduleHandler()->moduleExists('hsts')) {
$content_security_policy = [
'#tag' => 'meta',
'#attributes' => [
'http-equiv' => 'Content-Security-Policy',
@mecmartini
mecmartini / .htaccess-environment-conditionals
Last active May 24, 2018 09:53
Example of .htaccess environment conditionals
<IfModule mod_rewrite.c>
RewriteEngine on
# SET UP DEFAULT ENVIORNMENT TO MASTER
RewriteRule .* - [E=ENVIRONMENT:master]
# SET UP ENVIORNMENT TO DEVELOP IF WE ARE ON localhost OR .dev OR .local
RewriteCond %{SERVER_NAME} localhost [OR]
RewriteCond %{SERVER_NAME} .dev$ [OR]
RewriteCond %{SERVER_NAME} .local$
@mecmartini
mecmartini / html5-form-invalid-hint-scroll-with-fixed-bar.js
Last active June 1, 2018 16:37
HTML5 form invalid hint scroll with fixed bar
function scrollToInvalid() {
// Height of your nav bar plus a bottom margin
var navHeight = $('header.navbar-fixed-top').height() + 20;
// Offset of the first input element minus your nav height
var invalid_el = $('input:invalid,select:invalid,textarea:invalid').first().offset().top - navHeight;
// If the invalid element is already within the window view, return true. If you return false, the validation will stop.
if ( invalid_el > (window.pageYOffset - navHeight) && invalid_el < (window.pageYOffset + window.innerHeight - navHeight) ) {
return true;
} else {
@mecmartini
mecmartini / select-chosen-fix-for-html5-invalid-hint.js
Created June 1, 2018 15:49
Select chosen fix for HTML5 invalid hint
$.fn.oldChosen = $.fn.chosen;
$.fn.chosen = function (options) {
var select = $(this),
is_creating_chosen = !!options;
if (is_creating_chosen && select.css('position') === 'absolute') {
// if we are creating a chosen and the select already has the appropriate styles added
// we remove those (so that the select hasn't got a crazy width), then create the chosen
// then we re-add them later
select.removeAttr('style');
@mecmartini
mecmartini / adva-media-entity-support.patch
Last active June 4, 2018 17:23
Drupal contrib module adva - media entity support patch
diff --git a/modules/adva_media/adva_media.info.yml b/modules/adva_media/adva_media.info.yml
index 198ba8a..eefadf1 100644
--- a/modules/adva_media/adva_media.info.yml
+++ b/modules/adva_media/adva_media.info.yml
@@ -6,4 +6,4 @@ type: module
dependencies:
- adva:adva
- - drupal:media
+ - media_entity:media_entity
@mecmartini
mecmartini / jsonapi_set_maximum_page_limit_to_300.patch
Last active June 18, 2018 17:33
Set drupal jsonapi page limit to 300
diff --git a/src/Query/OffsetPage.php b/src/Query/OffsetPage.php
index 7e1a7a0..9c82050 100644
--- a/src/Query/OffsetPage.php
+++ b/src/Query/OffsetPage.php
@@ -42,7 +42,7 @@ class OffsetPage {
*
* @var int
*/
- const SIZE_MAX = 50;
+ const SIZE_MAX = 300;
@mecmartini
mecmartini / buscador.css
Created April 26, 2019 14:11
Jesus Fernandez - Boogle buscador
#principal{
position: absolute;
left: 0;
top: 200px;
width: 100%;
}
.principal-inner {
width: 800px;
margin: 0 auto;