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
$types = node_type_get_types(); | |
$option_types = array(); | |
foreach($types as $type){ | |
$option_types[$type->type] = $type->name; | |
} | |
$form['migration_type'] = array( | |
'#type' => 'select', | |
'#options' => $option_types, | |
'#title' => t('Select the contet type to be created?'), |
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
function mymodule_views_query_alter(&$view, &$query) { | |
if ($view->name == 'myview' ) { | |
//Filter taxonomy by language | |
global $language; | |
$query->where[] = array( | |
'conditions' => array(array( | |
'field' => 'taxonomy_term_data.language', | |
'value' => array($language->language), | |
'operator' => 'in', | |
)), |
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
$view = 'my_view_name'; | |
$display = 'my_display'; | |
$alter = array('exposed' => array('title' => 'title I search'), 'node_created_order' => 'ASC'); | |
//Simple results of a view | |
public function getResults($view, $display, $args = NULL){ | |
return views_get_view_result($view, $display, $args); | |
} | |
//View with exposed filters and more things |
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
/** | |
*Render a block | |
*/ | |
function block_render($module, $block_id) { | |
$block = block_load($module, $block_id); | |
if(!isset($block->title)){ | |
$block->title = ''; | |
} | |
if(!isset($block->region)){ | |
$block->region = ''; |
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
function mymodule_query_alter(QueryAlterableInterface $query){ | |
$is_search = FALSE; | |
foreach ($query->getTables() as $table) { | |
if ($table['table'] == 'search_index') { | |
$is_search = TRUE; | |
} | |
} | |
if ($is_search) { | |
global $language; |
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
$name = 'my_view'; | |
$display = 'page_1'; | |
$exposed = array('title', 'type', 'created'); | |
public function hasExposed($name, $display, $exposed){ | |
$view = views_get_view($name); | |
$view->set_display($display); | |
$view->preview=TRUE; | |
$view->is_cacheable = FALSE; | |
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
if(!empty($ids)){ | |
$ids2 = array_filter($ids); | |
if(!is_null($ids2)){ | |
$ids2 = array_filter($ids2, 'is_string'); | |
} | |
if(!is_null($ids2)){ | |
$ids2 = array_filter($ids2, 'strlen'); | |
} | |
}else{ |
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
function module_field_default_fields_alter(&$fields) { | |
$source_dir = drupal_get_path('theme', 'soc') . '/images/default'; | |
$field_default_images = array( | |
//'user-user-field_user_picture' => 'avatar.png', - This is exported in the feature | |
//'field_collection_item-field_people-field_people_photo' => 'avatar.png', - example for field collection | |
'node-event-field_event_image' => 'minificha_eventos.gif', | |
'node-news-field_image' => 'minificha_noticias.gif', | |
); |
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
asd |
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
(function () { | |
'use strict'; | |
angular.module('myApp') | |
.factory('UtilsSrv', | |
[ function () { | |
//You can disable the loggin of data here, also you can set the level of debug | |
var debugMode = true; | |
var logLevel = 3; |
OlderNewer