This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function nike_ugc_node_presave($node) { | |
$journal_wrapper = entity_metadata_wrapper('node', $node); | |
// If this is a new journal entry set it's course reference. | |
if ($journal_wrapper->getBundle() == 'journal_entry') { | |
// If this is the first time the journal is saved, attach the course. | |
if (!$journal_wrapper->getIdentifier() && arg(0) == 'node' && is_numeric(arg(1))) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Render promo | |
*/ | |
function nike_promo_preprocess_node(&$vars, $hook) { | |
$class = ''; | |
$style = ''; | |
$node = $vars['node']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Losslessly compressing http://www.thenewgroup.com/…/portfolio-tile-images/_0012_samsung.jpg could save 98KiB (87% reduction). | |
Losslessly compressing http://www.thenewgroup.com/…s/portfolio-tile-images/sh_tile.jpg.jpeg could save 56.8KiB (63% reduction). | |
Losslessly compressing http://www.thenewgroup.com/…files/portfolio-tile-images/wcg_tile.jpg could save 54.8KiB (71% reduction). | |
Losslessly compressing http://www.thenewgroup.com/…tfolio-tile-images/_0006_r2-SR Smith.jpg could save 46.6KiB (63% reduction). | |
Losslessly compressing http://www.thenewgroup.com/…folio-tile-images/_0005_r2-Grammy365.jpg could save 45.7KiB (65% reduction). | |
Losslessly compressing http://www.thenewgroup.com/…olio-tile-images/_0008_r3-Jenny SM_0.jpg could save 43KiB (72% reduction). | |
Losslessly compressing http://www.thenewgroup.com/…efault/files/client-logos/jennycraig.png could save 4.1KiB (72% reduction). | |
Losslessly compressing http://www.thenewgroup.com/…tion-statement-images/homepage_wide2.jpg could save 3.1KiB (3% reduction). | |
Lossles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Basic anonymous site functionality | |
In order to prove that this site has been setup successfully | |
As an anonymous user | |
I need to see a home page | |
Background: | |
Given I am an anonymous user | |
Scenario: Anonymous user can see the home page | |
When I visit "/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Utility function to create fields on a content type. | |
* | |
* @param string $field_name | |
* Name of the field, like field_something | |
* @param string $widget_type | |
* Widget type, like field_example_3text | |
* @param int $cardinality | |
* Cardinality |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function stargazer_preprocess_node(&$vars) { | |
$class = ''; | |
$style = ''; | |
$node = $vars['node']; | |
// Modify submitted by text | |
$vars['submitted'] = t('!datetime by !username', | |
array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_entity_view_mode_alter(). | |
*/ | |
function HOOK_entity_view_mode_alter(&$view_mode, $context) { | |
// If a formula teaser is displayed, check if multi-display and update view mode. | |
if ($view_mode == 'formula_teaser') { | |
$nid = $context['entity']->nid; | |
if(in_array($nid, $GLOBALS['multi_display'])) { | |
$view_mode = 'formula_list'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function web2theme_preprocess_user_profile(&$variables) { | |
if( arg(2)==null ) { //im not editing | |
$qty_field=count($variables['user_profile']['field_telefone']['#items']); | |
for($i=0 ; $i<$qty_field; $i++) { | |
$field_collection_id = $variables['field_telefone'][$i]['value']; | |
//dsm($variables['user_profile']['field_telefone'][$i]['entity']['field_collection_item'][$field_collection_id]['field_telefone_showed']); | |
$toshow = $variables['user_profile']['field_telefone'][$i]['entity']['field_collection_item'][$field_collection_id]['field_telefone_showed']; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function HOOK_ugc_node_presave($node) { | |
$journal_wrapper = entity_metadata_wrapper('node', $node); | |
// If this is a new journal entry set it's parent reference. | |
if ($journal_wrapper->getBundle() == 'journal_entry') { | |
// If this is the first time the journal is saved, attach the course. | |
if (!$journal_wrapper->getIdentifier() && arg(0) == 'node' && is_numeric(arg(1))) { | |
$course_wrapper = entity_metadata_wrapper('node', arg(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Implements of hook_form_alter(). | |
*/ | |
function hitachi_module_form_alter(&$form, &$form_state, $form_id) { | |
$domain = domain_get_domain(); | |
switch ($form_id) { | |
case 'user_register_form'; | |
$path = check_plain($_GET['destination']); |