This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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?'), |
NewerOlder