Skip to content

Instantly share code, notes, and snippets.

@wimleers
wimleers / edit_for_all_entities.patch
Created April 9, 2013 13:40
In-place editing for all entity types, not just nodes :)
diff --git a/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php b/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php
index 9eac5bc..a66ef05 100644
--- a/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php
+++ b/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php
@@ -41,10 +41,7 @@ public function access(Route $route, Request $request) {
* Implements EntityFieldAccessCheckInterface::accessEditEntityField().
*/
public function accessEditEntityField(EntityInterface $entity, $field_name) {
- $entity_type = $entity->entityType();
- // @todo Generalize to all entity types once http://drupal.org/node/1862750
@wimleers
wimleers / css_aggregation_file_url_rewriting_fix.patch
Created April 4, 2013 14:12
Moves file_create_url() calls from once per aggregated CSS file (which is very wrong) to once per actual referenced file (which is right).
$ git d
includes/common.inc | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/includes/common.inc b/includes/common.inc
index 27fa190..7324b00 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -3562,17 +3562,10 @@ function drupal_build_css_cache($css) {
if ($stylesheet['type'] == 'file') {
core/modules/ckeditor/js/ckeditor.admin.js | 35 ++++++++--------------------
1 file changed, 10 insertions(+), 25 deletions(-)
diff --git a/core/modules/ckeditor/js/ckeditor.admin.js b/core/modules/ckeditor/js/ckeditor.admin.js
index a483296..7d0d755 100644
--- a/core/modules/ckeditor/js/ckeditor.admin.js
+++ b/core/modules/ckeditor/js/ckeditor.admin.js
@@ -206,43 +206,28 @@ Drupal.behaviors.ckeditorAdmin = {
* Asynchronously retrieve the metadata for all available CKEditor features.
*/
public function getUntransformedText(EntityInterface $entity, $field_name, $langcode, $view_mode) {
$response = new AjaxResponse();
// Direct text editing is only supported for single-valued fields.
$field = $entity->getTranslation($langcode, FALSE)->$field_name;
$editable_text = check_markup($field->value, $field->format, $langcode, FALSE, array(FILTER_TYPE_TRANSFORM_REVERSIBLE, FILTER_TYPE_TRANSFORM_IRREVERSIBLE));
$response->addCommand(new GetUntransformedTextCommand($editable_text));
return $response;
}
<p>PullPush</p>
<p>Transfer protocolnoneFTP,&nbsp;SFTP, WebDAV, Amazon S3 &hellip;</p>
<p>Advantagesvirtually no setup</p>
<ul>
<li>flexibility</li>
<li>no redundant&nbsp;traffic</li>
</ul>
@wimleers
wimleers / gist:4547030
Created January 16, 2013 13:09
`git pull`ing on a Drupal core repo that was last updated on January 11. Now we're January 16. Wow.
wim.leers at wimleers-acquia in ~/Work/drupal on 8.x*
$ git pull
remote: Counting objects: 794, done.
remote: Compressing objects: 100% (334/334), done.
remote: Total 503 (delta 313), reused 98 (delta 77)
Receiving objects: 100% (503/503), 130.04 KiB | 134 KiB/s, done.
Resolving deltas: 100% (313/313), completed with 215 local objects.
From http://git.drupal.org/project/drupal
77f0384..ee1b6de 8.x -> origin/8.x
Updating 77f0384..ee1b6de
@wimleers
wimleers / .mrconfig
Last active December 11, 2015 01:39
Initial attempt at .mrconfig for simplified Drupal deployment.
[DEFAULT]
lib =
# @TODO
# http://en.wikipedia.org/wiki/Development,_testing,_acceptance_and_production
environment() {
return dev
}
checkout_drupal_project() {
# Look up variables.
project=`mr config ${MR_REPO//${MR_CONFIG%.*}/} project`
/**
* @file
* Determines which editor (Create.js PropertyEditor widget) to use.
*/
(function (jQuery, Drupal, drupalSettings) {
"use strict";
jQuery.widget('Drupal.createEditable', jQuery.Midgard.midgardEditable, {
_create: function () {
[alias]
# View the SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 10 --graph
# Better, prettier log view (including author and relative date)
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
# View the current working tree status using the short format
s = status -s
# Diff
d = diff --patch-with-stat
# Diff, inline
@wimleers
wimleers / drupal.mdown
Created October 2, 2012 19:35 — forked from lyzadanger/drupal.mdown
RE: My Woes with Drupal

This is a reply to https://gist.github.com/3800860.

Hokay, please keep in mind I know nothing about Drupal 8, so much of what I comment on here may well be problems that are already being addressed or have been solved therein. AGAIN: If I make a poopoo face at something that has been rectified in D8, please don't be terribly irritated at me!

I am a longtime D6 dev, and have been working in D7 for the past few months, as well.

Core issues as I see them in terms of the mobile Web and the pan-device Web as a whole:

  • Controllers need to be separated from template/view layers in so much as is possible. There is still too much munging between page callbacks/action and the rendered response. I think this is sort of part of what render arrays aim to ease in D7, but render arrays are complex and abysmally documented. I have asked around and no one can find true documentation on them. They're far too convoluted to figure out on one's own unless one has a lot of time, which I sadly do not.
  • Let m