Skip to content

Instantly share code, notes, and snippets.

View flashvnn's full-sized avatar

Huynh Khac Thao flashvnn

View GitHub Profile
@flashvnn
flashvnn / httpd-vhosts.conf
Created May 14, 2014 09:14
Config APC on windows
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "D:\devsoft\xampp\htdocs\migratedev"
ServerName migratedev.dev
ErrorLog "logs/migratedev.dev-error.log"
CustomLog "logs/migratedev.dev-access.log" common
<Directory "D:\devsoft\xampp\htdocs\migratedev">
AllowOverride All
php_admin_value apc.enabled 1
php_admin_value apc.filters "-D:/devsoft/xampp/htdocs/migratedev/sites/all/modules/custom/*"
@flashvnn
flashvnn / fft-flexslider.tpl.php
Created May 15, 2014 02:15
Field formmater template: flexslider
<?php
/*Template Name: FlexSlider Slideshow*/
// Add js and css
drupal_add_js("sites/all/libraries/flexslider/jquery.flexslider.js");
drupal_add_css("sites/all/libraries/flexslider/flexslider.css");
//dpm($data);
?>
<!-- Place somewhere in the <body> of your page -->
@flashvnn
flashvnn / fft-flexslider-thumb.tpl.php
Created May 15, 2014 03:48
Field Formmatter Template FlexSlider Thumbnail.
<?php
/*Template Name: FlexSlider Thumbnail Slideshow*/
// Add js and css.
drupal_add_js("sites/all/libraries/flexslider/jquery.flexslider.js");
drupal_add_css("sites/all/libraries/flexslider/flexslider.css");
// dpm($data);
// FlexSlider need jQuery >= 1.7 so you need install jquery_update module and
// select jQuery 1.7 for your Drupal.
?>
@flashvnn
flashvnn / fft-carouFredSel-71.tpl.php
Created May 15, 2014 04:28
Field Formatter Template with CarouFredSel example 71
<?php
/*Template Name: CarouFredSel Example 71*/
// Organic Code http://coolcarousels.frebsite.nl/c/71/
// Add js
// You can download caroufredsel library and place at sites/all/libraries folder
// Or using cdn library.
drupal_add_js("//cdnjs.cloudflare.com/ajax/libs/jquery.caroufredsel/6.2.1/jquery.carouFredSel.packed.js");
?>
@flashvnn
flashvnn / fft-owl-carousel.tpl.php
Created May 15, 2014 06:49
Field Formatter Template with Owl Carousel
@flashvnn
flashvnn / httpd.conf
Created May 20, 2014 06:13
Apache config allow serve other directory
<Directory />
Options FollowSymLinks
AllowOverride All
Allow from all
</Directory>
@flashvnn
flashvnn / template.php
Created May 26, 2014 04:38
Drupal override theme image style to remove query string
<?php
/**
* Override theme image style to remove query string.
*/
function zmbootstrap_image_style($variables) {
// Determine the dimensions of the styled image.
$dimensions = array(
'width' => $variables['width'],
'height' => $variables['height'],
);
@flashvnn
flashvnn / bluecollar_helper.module
Created May 29, 2014 09:46
Create blocks of first items of main-menu
<?php
/**
* Implements hook_block_info().
*/
function bluecollar_helper_block_info() {
/* $blocks['bluecollar_resource_filter'] = array(
'info' => t('Resource Filter'),
'cache' => DRUPAL_CACHE_PER_ROLE,
);
*/
@flashvnn
flashvnn / drupal_goto.php
Created May 30, 2014 04:09
Force drupal redirect with drupal_goto
<?php
function mymodule_force_goto($url) {
$_GET['destination'] = $url;
drupal_goto($url);
}
@flashvnn
flashvnn / filedtypes.php
Created June 3, 2014 04:44
Drupal 8 get all fields types
<?php
function fft_get_field_types() {
return array_keys(\Drupal::service('plugin.manager.field.field_type')->getDefinitions());
}