Skip to content

Instantly share code, notes, and snippets.

<?php
protected function get_entity_type() {
$class = get_class($this);
$types = entity_get_info();
foreach ($types as $entity_type => $info) {
if (isset($info['entity class']) && $class == $info['entity class']) {
return $entity_type;
}
}
section#main,
header,
footer {
.container {
@include outerRow();
}
}
header,
footer {
@mikeyp
mikeyp / honeybadger.module
Created June 21, 2013 22:55
Lets play a game. Do you think it's possible to un-check "Emergency" on the settings form, and save that change?
<?php
/**
* Form builder for settings form.
*/
function honeybadger_settings_form($form, &$form_state) {
$form['honeybadger_api_key'] = array(
'#type' => 'textfield',
'#title' => t('Honeybadger.io API key'),
'#default_value' => variable_get('honeybadger_api_key'. ''),
@mikeyp
mikeyp / html.html.twig
Created June 16, 2015 21:08
Oh Drupal!!
{% if head_title is iterable %}
<title>{{ head_title|safe_join(' | ') }}</title>
{% else %}
<title>{{ head_title }}</title>
{% endif %}
@mikeyp
mikeyp / gist:e517bf75611f69d702e3
Created June 10, 2015 20:31
project.make.yml
core: 8.x
api: 2
defaults:
projects:
subdir: contrib
location: "http://updates.drupal.org/release-history" # Workaround for missing SSL on updates.drupal.org
# Drupal Core
projects:
include_once(/Users/MYCOWORKERSNAME/git/client-com/drupal/themes/custom/client/client.theme): failed to open stream: No such file or [warning]
directory in Drupal\Core\Extension\Extension-&gt;load() (line 145 of
core/lib/Drupal/Core/Extension/Extension.php).Drupal\Core\Extension\Extension->load()
Drupal\Core\Extension\Extension->load()
twig_init(Object)
call_user_func('twig_init', Object)
Drupal\Core\Theme\ThemeInitialization->loadActiveTheme(Object)
Drupal\Core\Theme\ThemeInitialization->initTheme('client')
Drupal\Core\Theme\ThemeManager->initTheme(NULL)
Drupal\Core\Theme\ThemeManager->getActiveTheme()
@mikeyp
mikeyp / awyiss.coffee
Created April 17, 2015 20:08
Hubot plugin
# Description:
# aw yiss
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
mikey-p ~/git/example/drupal (dev): drush cc drush --debug
Starting Drush preflight. [0.01 sec, 451.49 KB] [preflight]
Cache MISS cid: 7.0-dev-commandfiles-0-95a56dc71d69d1c02a2a6e6dd9e7ee4b [0.01 sec, 474.91 KB] [debug]
Cache SET cid: 7.0-dev-commandfiles-0-95a56dc71d69d1c02a2a6e6dd9e7ee4b [0.03 sec, 501.31 KB] [debug]
Bootstrap to phase 0. [0.17 sec, 2.73 MB] [bootstrap]
Drush bootstrap phase : bootstrap_drupal_root() [0.17 sec, 2.74 MB] [bootstrap]
Initialized Drupal 7.34 root directory at /Users/mdp/git/example/drupal [0.18 sec, 2.76 MB] [notice]
Cache MISS cid: 7.0-dev-commandf
mikey-p ~/git/projectname/drupal (dev): drush --version
Drush Version : 7.0.0-alpha9
mikey-p ~/git/projectname/drupal (dev): drush sql-conf
Array
(
[driver] => mysql
[database] => projectname
[username] => root
[host] => localhost
mikey-p ~/git/example.org (master): drush --version
Drush Version : 7.0.0-alpha9
mikey-p ~/git/example.org (master): drush sa @dev
$aliases["dev"] = array (
'uri' => 'dev.example.org',
'root' => '/var/www/dev.example.org/htdocs',
'remote-host' => 'example.org',
'remote-user' => '316e',
'path-aliases' =>
array (