Skip to content

Instantly share code, notes, and snippets.

View flashvnn's full-sized avatar

Huynh Khac Thao flashvnn

View GitHub Profile
@flashvnn
flashvnn / ckecitor_helper.js
Created June 6, 2014 03:43
CKeditor remove bottom bar and change height
config.removePlugins = 'elementspath';
config.resize_enabled = false;
config.height = 30;
@flashvnn
flashvnn / bluecollar_helper.php
Last active August 29, 2015 14:02
Drupal force text format for a field
<?php
/**
* Implements hook_element_info_alter().
*
* Sets the text format processor to a custom callback function.
* This code is taken from the Better Formats module.
*/
function bluecollar_helper_element_info_alter(&$type) {
if (isset($type['text_format']['#process'])) {
foreach ($type['text_format']['#process'] as &$callback) {
@flashvnn
flashvnn / redirect.module
Created June 10, 2014 04:49
Drupal redirect with params
<?php
function module_form_course_node_form_submit($form, &$form_state) {
$form_state['redirect'] = array(
'node/'. $form_state['nid']. '/edit',
array(
'query' => array(
'cmd' => $cmd,
),
),
@flashvnn
flashvnn / node_types_view_mode.php
Created June 10, 2014 09:29
Drupal list all node types and view mode
<?php
$node_types = array();
foreach (node_type_get_types() as $type => $item) {
$node_types[$type] = $item->name;
}
$form['type'] = array(
'#type' => 'select',
'#title' => t('Content Type'),
'#options' => $node_types,
@flashvnn
flashvnn / .gitignore
Last active August 29, 2015 14:02
Git ignore for Drupal
# Ignore paths that contain user-generated content.
/sites/*/files
/sites/*/private
/files/*
/cache
# ** Only works in OSs that support newer versions of fnmatch (Bash 4+)
/sites/default/**/files
/sites/default/**/private
/sites/default/settings.php
Which is not valid PHP code?
(5 scores)
$10_somethings
$_10
${"MyVar"}
$aVaR
(Number of correct answers: 1)
@flashvnn
flashvnn / panels-layout.php
Last active August 29, 2015 14:03
panels-layout classes
<?php
$wrapper_classes = array();
$item = menu_get_item();
if ($item['path'] == 'blog' ||$item['path'] == 'taxonomy/term/%' || $item['path'] == 'posts-date/%') {
$wrapper_classes[] = 'blog';
}
if (isset($vars['node']) && $vars['node']->type == 'article') {
$wrapper_classes[] = 'blog-single';
}
?>
@flashvnn
flashvnn / _header.scss
Created August 14, 2014 04:14
Menu center
@media (min-width: 768px){
#primary-menu-bar .menu-wrapper{
float:none;
margin: 0 auto;
display: table;
table-layout: fixed;
}
}
@flashvnn
flashvnn / _header.scss
Created August 14, 2014 04:14
Menu center
@media (min-width: 768px){
#primary-menu-bar .menu-wrapper{
float:none;
margin: 0 auto;
display: table;
table-layout: fixed;
}
}
@media (min-width: 768px){
#primary-menu-bar .menu-wrapper{
float:none;
margin: 0 auto;
display: table;
table-layout: fixed;
}
}