This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_form_FORM_ID_alter(). | |
*/ | |
function mymodule_form_taxonomy_my_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
// Hide fieldset relations for flat hierarchy taxonomies. | |
$form['relations']['#required'] = FALSE; | |
$form['relations']['#access'] = FALSE; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
custom_view: | |
css: | |
component: | |
css/custom_view.css: {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Theme name | |
type: theme | |
description: Theme description | |
package: Custom | |
core: 8.x | |
libraries: | |
- themename/fonts | |
- themename/global-styling | |
base theme: classy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_form_alter(). | |
*/ | |
function mymodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { | |
if ($form_id == 'node_article_edit_form') { | |
$form['my_view'] = [ | |
'#markup' => 'Some arbitrary markup.', | |
]; | |
// Access entity object. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch | grep -v "develop" | sed 's/^[ *]*//' | sed 's/^/git branch -d /' | bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
entity.taxonomy_term_runner.add_form: | |
route_name: entity.taxonomy_term.add_form | |
route_parameters: | |
taxonomy_vocabulary: 'runner' | |
title: 'Add runner' | |
appears_on: | |
- view.runners.page_admin_runners |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$route_name = \Drupal::service('current_route_match')->getRouteName(); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$link_url = Url::fromRoute('node.add', array('node_type' => $content_type)); | |
$link_url->setOptions(array( | |
'attributes' => array( | |
'class' => array('button') | |
), | |
'query' => \Drupal::destination()->getAsArray(), | |
)); | |
$link_text = t('Add !content_type content', array('!content_type' => ucfirst($content_type))); | |
// Build link |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract CREATE / INSERT from default mysql dump. | |
zcat > dump.sql.gz | sed -n -e '/CREATE TABLE.*`my_table`/,/UNLOCK TABLES/p' > my_table.sql | |
# Extract INSERTs only. | |
zcat > dump.sql.gz | sed -n -e '/INSERT INTO `my_table`/,/UNLOCK TABLES/p' > my_table.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* We are overriding a large part of the JS defined in leaflet (leaflet.drupal.js). | |
* Not nice, but we can't do otherwise without refactoring code in Leaflet. | |
*/ | |
(function ($) { | |
var LEAFLET_MARKERCLUSTER_EXCLUDE_FROM_CLUSTER = 0x01; | |
Drupal.behaviors.leaflet = { // overrides same behavior in leaflet/leaflet.drupal.js |