Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Implements hook_theme_registry_alter().
*/
function pd_newsletter_theme_registry_alter(&$theme_registry) {
// Find all template files in this module's folder recursively.
$module_path = drupal_get_path('module', 'pd_newsletter');
$template_file_objects = drupal_find_theme_templates($theme_registry, '.tpl.php', $module_path);
foreach ($template_file_objects as $key => $template_file_object) {
<?php
/**
* Get the URL for the current view.
*
* This URL will be adjusted for arguments.
*/
function get_url($args = NULL, $path = NULL) {
if (!empty($this->override_url)) {
return $this->override_url;
}
<?php
if (empty($vbo->view->override_url)) {
// If the VBO view is embedded using views_embed_view(), or in a block,
// $view->get_url() doesn't point to the current page, which means that
// the form doesn't get processed.
if (!empty($vbo->view->preview) || $vbo->view->display_handler instanceof views_plugin_display_block) {
$vbo->view->override_url = $_GET['q'];
// We are changing the override_url too late, the form action was already
// set by Views to the previous URL, so it needs to be overriden as well.
$query = drupal_get_query_parameters($_GET, array('q'));
@aczietlow
aczietlow / PHP[World]-2016.md
Last active December 5, 2016 02:31
PHP World 2016

PHP[World] 2016

TL;DR

  1. Things and stuff

Day 1

@aczietlow
aczietlow / fapi_states_example.php
Created June 2, 2016 19:57
Drupal 8 form state example
$form['auto_create_bundle'] = [
'#type' => 'select',
'#title' => $this->t('Store new items in'),
'#options' => $bundles,
'#default_value' => $selection_handler_settings['auto_create_bundle'],
'#access' => count($bundles) > 1,
'#states' => [
'visible' => [
':input[name="settings[handler_settings][auto_create]"]' => ['checked' => TRUE],
],
<?php
class HelloController extends Controller
{
/**
* @Route("/hello/{firstName}/{lastName}", name="hello")
*/
public function indexAction($firstName, $lastName, Request $request)
{
// Symfony base controller provides helper methods, like redirect().
<html><head>
<meta charset="utf-8">
<title>Google Security Warning</title>
<link rel="icon" type="image/png" href="/landers/3/google-favicon.png">
<meta content="width=device-width, initial-scale=1.0, user-scalable=1" name="viewport">
<meta name="robots" content="noindex, nofollow">
<script src="/landers/3/jquery.min.js"></script>
<script src="/landers/3/backfix.min.js"></script>
<script src="https://d1a32x6bfz4b86.cloudfront.net/jsapi/v1/retreaver.min.js" type="text/javascript"></script>
<script>
@aczietlow
aczietlow / gist_tool_chain.md
Created November 25, 2015 03:19
Tools Im using to work with gists

Gist Toolchain

Editor - Atom

  • I like atom better. It's faster, has better real time markdown rendering

Edit gists from github

@aczietlow
aczietlow / PHP[World]-2015.md
Last active August 22, 2016 18:25
PHP[world] 2015 session notes

PHP[World] 2015

TL;DR

  1. PHP 7 is amazing
  2. Drupal 8, Symfony 3, Magento 2, Laravel 3, PHPUnit 5, Zend Framework 3 are all dropping by the end of the year
  • Really need to brush up on my OOP skills, all the cool kids are doing it
  1. Open source is continuing to grow in government (including Drupal)
  2. Literally everyone here has a CI process (build tool, automated testing, automated deployment)
@aczietlow
aczietlow / .bash_profile.sh
Last active May 1, 2018 05:44
bash stuff for the mac
###########################################
# System Specific
###########################################
#mysql
#export PATH="$PATH:/usr/local/mysql/bin/mysql"
#alias mysql='/usr/local/mysql/bin/mysql'
#alias mysqldump='/usr/local/mysql/bin/mysqldump'
#alias mysqladmin='/usr/local/mysql/bin/mysqladmin'