Skip to content

Instantly share code, notes, and snippets.

@mareksotak
mareksotak / context ui
Created November 19, 2010 15:30
Context UI Block
/**
* Implementation of hook_block().
*/
function mymodule_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks = array();
if (module_exists('jquery_ui') && module_exists('context')) {
$blocks['editor'] = array('info' => t('One Context editor'), 'admin' => TRUE);
}
@mareksotak
mareksotak / main_menu.php
Created July 14, 2011 22:14
Add span to first level items only
<?php
function mytheme_preprocess_menu_link__main_menu(&$vars) {
// first level
if ($vars['element']['#original_link']['plid'] == 0) {
$vars['first_level'] = 1;
if ($vars['element']['#original_link']['in_active_trail']) {
$vars['active'] = 1;
}
}
<?php
/**
* Implements hook_form_alter().
To Replace the -Any- value in filters by it's label text
*/
function theme_form_alter(&$form, &$form_state, $form_id) {
kpr($form);
if ($form['#id'] == 'views-exposed-form-admin-people-block-1') {
// $my_label = 'label name';

Design & Frontend

Description

Building successful, useable high-performing and beautiful websites requires you to go beyond the framework. Every time.

Having a framework to build on - no matter how flexible and powerful - is only the first step. This year's frontend track will focus on implementing established best practices in both design, workflow and code.

Together we will take your Drupal websites that important step further.

Main themes

Applying frontend and UX best practices in Drupal

@mareksotak
mareksotak / template.php
Last active August 29, 2015 14:10
FB Commons - making the Like button look like link
<?php
/**
* These functions should be in template.php of your theme
* Just replace commons_origins with your theme name
*/
/**
* Implements hook_preprocess_rate_template_commons_like().
*/
function commons_origins_preprocess_rate_template_commons_like(&$variables, $hook) {
.inmplayer-launcher::before {
content: "TAKE A TOUR";
top: 0;
left: 0;
color: #000;
display: block;
height: 20px;
width: 100px;
text-indent: 0;
}
.inmplayer-trigger {
right: -52px;
}
inline_manual_player.setCallbacks({
onStepShow: function (player, topic_id, step_id) {
console.log(player.topics[topic_id].steps.length);
}
});
@-webkit-keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.inmplayer-popover {
@mareksotak
mareksotak / anonymous_trigger_topic.js
Last active April 7, 2016 09:25
Launch a topic for anonymous users - set cookie they have seen it
if (/(^|;)\s*visited=/.test(document.cookie)) {
// seen the tutorial, do nothing
} else {
document.cookie = "tutorialSeen=true; max-age=" + 60 * 60 * 24 * 10; // 60 seconds to a minute, 60 minutes to an hour, 24 hours to a day, and 10 days.
inline_manual_player.activateTopic(1234); // 1234 is the topic id
}