Skip to content

Instantly share code, notes, and snippets.

View lincoln-chawora's full-sized avatar

Lincoln Chawora lincoln-chawora

  • TPX Impact
View GitHub Profile
@lincoln-chawora
lincoln-chawora / resize_window_size.js
Created September 2, 2019 16:38
How to make changes on the window resize using the jquery-smartresize library
$(window).on('debouncedresize', function() {
var win = $(this);
if (win.width() > 768) {
$footerMenuContent.find('li:hidden').show();
} else {
$footerMenuContent.find('> .menu > li:not(.first)').hide();
}
});
@lincoln-chawora
lincoln-chawora / menu_local_tasks_alter.php
Created September 2, 2019 12:03
How to remove a menu tab from a content type in drupal 8
/**
* Implements hook_menu_local_tasks_alter().
*
* Remove replicate menu tab.
*/
function YOUR_THEME_menu_local_tasks_alter(&$data, $route_name, RefinableCacheableDependencyInterface &$cacheability) {
$routes = &$data['tabs'][0];
if ($routes['replicate_ui.local_tasks:entity.node.replicate']) {
unset($routes['replicate_ui.local_tasks:entity.node.replicate']);
}
@lincoln-chawora
lincoln-chawora / paragraph_id_from_field_template.php
Created August 23, 2019 17:51
How to get paragraphs ID from inside a field template using a field preprocessor
$field['#object']->entity_id();