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 | |
module_load_include('inc', 'profile2_page', 'profile2_page'); | |
$profile2 = profile2_by_uid_load($user->uid, 'profile_id'); // profile_id = machine name | |
$entity_form = entity_ui_get_form('profile2', $profile2, 'edit'); | |
return $entity_form; |
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_menu_alter(). | |
*/ | |
function MY_MODULE_menu_alter(&$items) { | |
$items['user/%user_category/edit/profile']['access callback'] = 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
<?php | |
function MY_MODULE_form_alter(&$form, &$form_state, $form_id) | |
{ | |
$form['#prefix'] = '<div id="formwrapper">'; | |
$form['#suffix'] = '</div>'; | |
// the submit button | |
$form['save']['#ajax'] = array( | |
'callback' => 'MY_MODULE_form_ajax_submit', | |
'wrapper' => 'formwrapper', |
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
/** | |
* Implements hook_menu_local_task() | |
* | |
* @param array $variables | |
* | |
* return string with html | |
*/ | |
function mytheme_menu_local_task($variables) { | |
$link = $variables['element']['#link']; | |
// remove the view link when viewing the 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
<?php | |
/** | |
* implements hook_block_info() | |
**/ | |
function test_block_info(){ | |
$blocks = array(); | |
$blocks['custom_exposed_filter_form'] = array( | |
'info' => t('Exposed filter form'), | |
'cache' => DRUPAL_NO_CACHE, |
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_admin_paths(). | |
*/ | |
function myfeature_admin_paths() { | |
$paths = array( | |
'import' => TRUE, | |
'import/*' => TRUE, | |
'node/*/import' => TRUE, |
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
Assuming that you have a program running in the foreground, press ctrl-Z, then: | |
[1]+ Stopped myprogram | |
$ disown -h %1 | |
$ bg 1 | |
[1]+ myprogram & | |
$ logout |
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
{ | |
"query" : { "query_string" : {"query" : "*"} }, | |
"facets" : { | |
"tag" : { | |
"terms" : { | |
"field" : "id", | |
"script" : "term + \"|\" + _source.nom" | |
} | |
} | |
} |
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
{% for label, flashes in app.session.flashbag.all %} | |
{% for flash in flashes %} | |
<div class="alert alert-{{ label }}"> | |
{{ flash }} | |
</div> | |
{% endfor %} | |
{% endfor %} |
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_preprocess_views_slideshow_pager_fields() | |
*/ | |
function MYTHEME_preprocess_views_slideshow_pager_fields(&$vars) { | |
$slide_count = count($vars['view']->result); | |
$items_per_slide = $vars['view']->style_options['views_slideshow_cycle']['items_per_slide']; | |
if ($vars['view']->style_options['slideshow_type'] == 'views_slideshow_cycle') { |
OlderNewer