Skip to content

Instantly share code, notes, and snippets.

View csakiistvan's full-sized avatar
🏔️
happiness

Csáki István csakiistvan

🏔️
happiness
View GitHub Profile
@csakiistvan
csakiistvan / mymodule.module
Created July 1, 2014 14:32
how to create a translatable drupal pane title
<?php
/**
* Implements hook_preprocess_panels_pane().
*/
function hook_preprocess_panels_pane(&$vars) {
// Allow translation before substitution.
if (
!empty($vars['pane']->configuration['override_title'])
&& !empty($vars['pane']->configuration['override_title_text'])
@csakiistvan
csakiistvan / template.php
Last active August 29, 2015 14:02
add different css in different languages
<?php
/**
* Implements hook_preprocess_page().
*/
function mytheme_preprocess_page(&$vars) {
drupal_add_css(drupal_get_path('theme', 'mytheme') . '/css/mytheme_lang_' . $vars['language']->language . '.css');
}
@csakiistvan
csakiistvan / facebook div
Created May 27, 2014 17:23
Facebook like for multilanguage drupal website
<div class="fb-like" data-href="#" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>
@csakiistvan
csakiistvan / gist:09e57565b109874b7829
Last active August 29, 2015 14:01
Create node display from your module, #drupal
<?php
/**
* Implements hook_entity_info_alter().
*/
function MYMODULE_entity_info_alter(&$entity_info) {
$another_teaser = array(
'label' => t('Another teaser'),
'custom settings' => TRUE,
);
// WebKit font-smoothing
//------------------------------------------------
// References:
//
// 1. http://maxvoltar.com/sandbox/fontsmoothing/
// 2. http://maxvoltar.com/archive/-webkit-font-smoothing
//
// Values: none, antialiased (default), subpixel-antialiased
//
@csakiistvan
csakiistvan / gist:8705885
Created January 30, 2014 10:22
load term from field, and print as a link in preprocess page
function basetheme_preprocess_page(&$vars) {
$term = taxonomy_term_load($vars['node']->field_name_topic['und']['0']['target_id']);
$term_uri = taxonomy_term_uri($term); // get array with path
$term_title = taxonomy_term_title($term);
$term_path = $term_uri['path'];
$link = l($term_title,$term_path);
}
@csakiistvan
csakiistvan / new_gist_file
Created September 15, 2013 15:04
egyedi hatter egy gombhoz
<div>
<input type="checkbox" name="szeletelve" id="slices">
<label for="slices">
Szeletelve kérem
</label>
</div>
@csakiistvan
csakiistvan / index.html
Created September 12, 2013 11:50
One pager navigation, scroll to div id
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Drupal Developer Days, Szeged 2014</title>
<meta name="description" content="">
@csakiistvan
csakiistvan / new_gist_file.html
Created September 11, 2013 09:47
touch icons
<!-- non-retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="icon57.png" sizes="57x57">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="icon72.png" sizes="72x72">
<!-- non-retina iPad iOS 7 -->
<link rel="apple-touch-icon" href="icon76.png" sizes="76x76">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="icon114.png" sizes="114x114">
<!-- retina iPhone iOS 7 -->
<link rel="apple-touch-icon" href="icon120.png" sizes="120x120">
@csakiistvan
csakiistvan / parallax.js
Created September 1, 2013 13:54
Parallax, like stamfordglobal.com
(function ($) {
Drupal.behaviors.parallaxScrolling = {
attach: function (context) {
$('[data-type]').each(function() {
$(this).data('offsetY', parseInt($(this).attr('data-offsetY')));
$(this).data('speed', $(this).attr('data-speed'));
});
$('div[data-type="background"]').each(function() {