Skip to content

Instantly share code, notes, and snippets.

View labboy0276's full-sized avatar

John Ouellet labboy0276

View GitHub Profile
//Hunt and peck other FPP settings and change them to default language
$tables = db_query('SHOW TABLES')->fetchAll();
foreach($tables as $table) {
$key = key($table);
$tablename = $table->$key;
$tocheck = db_field_exists($tablename, 'entity_type');
$tocheck2 = db_field_exists($tablename, 'language');
if ($tocheck && $tocheck2) {
if (strpos($tablename, 'field_data_field') !== false) {
$fpp = db_select($tablename, 't')
@labboy0276
labboy0276 / djschusta
Created August 23, 2014 16:52
DJSchusta
<?php
function custom_multiling_enable() {
$admin_role = user_role_load_by_name('administrator');
$modules = array('locale','translation','i18n','i18n_block','i18n_variable', 'i18n_menu','i18n_node', 'i18n_string', 'l10n_client','l10n_update','title','entity_translation', 'i18n_panels');
foreach ($modules as $module) {
//check one more time if module is installed & enabled before perm set
if (!module_exists($module)) {
module_enable(array($module), TRUE);
@labboy0276
labboy0276 / pirofun
Created August 26, 2014 19:25
Adds Variant for Panels
<?php
/**
* Implements hook_entity_info_alter().
*/
function panelizer_variant_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['doctoral_programs'] = array(
'label' => t('Doctoral Programs'),
'custom settings' => TRUE,
);
@labboy0276
labboy0276 / Front Page Anchors
Last active August 29, 2015 14:06
Drupal Front Page Anchor Tags - Bootstrap
function <YOURTHEME>_links__system_main_menu($variables) {
$menu = '';
// Adds heading class
$menu .= '<h2 class="';
foreach ($variables['heading']['class'] as $key) {
$menu .= $key . ' ';
}
$menu .= '">Main menu</h2>';
// Adds UL classes
@labboy0276
labboy0276 / cvt batch
Created October 16, 2014 17:56
cvt batach
function cvt_management_report_census_form_submit($form, &$form_state) {
//POSTS - FORM INFO
$district_cvtid = $form_state['values']['district']; //hidden
$eff_month = $form_state['values']['eff_month'];
$plan_year = $form_state['values']['plan_year'];
//FORMAT THE MONTH/YEAR FOR THE API
if ($eff_month >= 10) {
//DOUBLE DIGIT MONTHS DO NOT NEED TO BE PADDED
@labboy0276
labboy0276 / cvt field collection
Created October 17, 2014 14:07
cvt field collection
function _cvt_client_trigger_field_collection_modification($entity, $type){
//If this isn't a field_collection submitted through a form,
//and ready to trigger Rules, we don't want it.
$entity_types = array(
'field_dependent' => 'dependent',
'field_plans' => 'plans',
'field_enrollee' => 'enrollee',
'field_dependent_cancellation' => 'dependent_cancellation',
);
@labboy0276
labboy0276 / alec
Created December 11, 2014 21:12
alec
/**
* Implements hook_menu().
*/
function cvt_termination_menu() {
$items = array();
$items['terminate/%userid/%'] = array(
'type' => MENU_LOCAL_TASK,
'page callback' => 'node_add',
'page arguments' => array('enrollee_termination', 1, 2),
@labboy0276
labboy0276 / alec
Created December 11, 2014 21:18
alec
/**
* Implements hook_menu().
*/
function cvt_termination_menu() {
$items = array();
$items['terminate/%userid/%'] = array(
'type' => MENU_LOCAL_TASK,
'page callback' => 'node_add',
'page arguments' => array('enrollee_termination', 1, 2),
@labboy0276
labboy0276 / Bootstrap Modal Print
Last active February 25, 2023 16:20
Bootstrap Modal Print
How to print a Bootstrap Modal (this was for Drupal 7 site as a FYI):
Add this to the modal
<button type="button" class="btn btn-default print" onClick="window.print();return false">Print</button>
Create a JS file and do this:
( function($) {
$(document).ready(function(){
// Add Print Classes for Modal
$('.modal').on('shown.bs.modal',function() {
@labboy0276
labboy0276 / gist:77711056ba2054d133f6
Last active August 29, 2015 14:23
Panels Everywhere + Default Search
Install the page_manager_search && search combine, set it up as you please but use search_combine as default.
Create a variant in the site_template for the search, set it to be above the default one. Use a selection for path URL sites/all/* on the string.
To render the default search_view as a block use:
/**
* Implements hook_block_info().
*/