Skip to content

Instantly share code, notes, and snippets.

View joelpittet's full-sized avatar

Joel Pittet joelpittet

View GitHub Profile
diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php
index 2d85f6a..7bcd33b 100644
--- a/core/lib/Drupal/Core/CoreBundle.php
+++ b/core/lib/Drupal/Core/CoreBundle.php
@@ -99,7 +99,7 @@ public static function registerTwig(ContainerBuilder $container) {
// This is saved / loaded via drupal_php_storage().
// All files can be refreshed by clearing caches.
// @todo ensure garbage collection of expired files.
- 'cache' => settings()->get('twig_cache', TRUE),
+ 'cache' => ((MAINTENANCE_MODE != 'install') ? settings()->get('twig_cache', TRUE) : FALSE),
@joelpittet
joelpittet / attributes-count
Created May 25, 2013 16:36
List of all the template files uses of attributes, title_attributes and content_attributes in d8
Drupal 8 Stats as of May 24th, 2013
`title_attributes` used in 12 templates or theme functions.
`content_attributes` used in 9 templates or theme functions and assumed existance in rdf.
`attributes` used in 35 templates or theme functions.
## Title Attributes
```
core/modules/block/templates/block.html.twig:

Example for terminology:

  • hook = hook
  • themeID = node
  • suggestionID = article

1) Definition

hook_theme()
function theme_link($variables) {
$rendered_text = is_array($variables['text']) ? drupal_render($variables['text']) : $variables['text'];
return l($rendered_text, $variables['path'], $variables['options']);
}
diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php
index 3c86bd1..dcee2f8 100644
--- a/core/lib/Drupal/Core/Template/TwigExtension.php
+++ b/core/lib/Drupal/Core/Template/TwigExtension.php
@@ -32,6 +32,7 @@ public function getFunctions() {
public function getFilters() {
return array(
't' => new \Twig_Filter_Function('t'),
+ 'placeholder' => new \Twig_Filter_Function('String::placeholder'),
);
@joelpittet
joelpittet / _menus.scss
Created August 16, 2013 23:44
mobile menu
/* Mobile Menu -------------------------------------------------------------- */
.mobile-menu {
background: center center no-repeat transparent;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAE1JREFUeNpi/P//PwOtARMDHQBdLGFBYt+nkR2KjEhxQqvIYaR7cD2glSWMo0mY3DiJo5Edi4ZPEqZ7nMSP5pPRon60qB9NwpQDgAADAMIxHUJvWs/TAAAAAElFTkSuQmCC);
background-color: #000;
display: block;
width: 40px;
height: 40px;
<?php
/**
* @file panels-pane.tpl.php
* Main panel pane template
*
* Variables available:
* - $pane->type: the content type inside this pane
* - $pane->subtype: The subtype, if applicable. If a view it will be the
* view name; if a node it will be the nid, etc.
* - $title: The title of the content
@joelpittet
joelpittet / 80character-ruler.patch
Created August 21, 2013 19:26
80 Character ruler
diff --git a/dreditor.user.js b/dreditor.user.js
index a247fab..b46007d 100644
--- a/dreditor.user.js
+++ b/dreditor.user.js
@@ -2821,7 +2821,13 @@ styles.innerHTML = " \
#dreditor-content { margin-left: 250px; border-left: 1px solid #ccc; overflow: scroll; height: 100%; } \
#dreditor-content, #code tr, #code td { font: 13px/18px Consolas, 'Liberation Mono', Courier, monospace; } \
#dreditor #code { position: relative; width:100%; } \
-#dreditor #code td { overflow: hidden; padding: 0 10px; } \
+#dreditor #code td { overflow: hidden; padding: 0 10px; \
SELECT (
(
SELECT COUNT(f.content_id)
FROM flag_content f
LEFT JOIN node n ON (f.content_id = n.nid AND n.status = 1)
WHERE
f.content_type = 'node'
AND n.type = 'manual'
AND f.fid = 3
AND f.uid = 10263
SELECT COUNT(n.nid)
FROM node n
LEFT OUTER JOIN (
SELECT f.content_id as nid
FROM flag_content f
LEFT JOIN node n ON (f.content_id = n.nid AND n.status = 1)
WHERE
f.content_type = 'node'
AND n.type = 'manual'