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
<?php | |
$entity = entity_create('field_collection_item', array('field_name' => 'field_education')); | |
$entity->profile_university_term[LANGUAGE_NONE][]['tid'] = _wj_users_reg_add_tag('university', $values); | |
$entity->profile_degree_term[LANGUAGE_NONE][]['tid'] = _wj_users_reg_add_tag('degree', $values); | |
$entity->profile_first_year[LANGUAGE_NONE][]['value'] = format_date($first_year_time, 'custom', 'Y-m-d H:i:s'); | |
$entity->profile_graduation_year[LANGUAGE_NONE][]['value'] = format_date($graduation_year_time, 'custom', 'Y-m-d H:i:s'); | |
$entity->setHostEntity('profile2', $profile); | |
$entity->save(); |
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
# rails generate controller Codes index show new create edit update destroy | |
class CodesController < ApplicationController | |
def index | |
@codes = Code.all | |
end | |
def show | |
@code = Code.find params[:id] | |
end |
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
<?php | |
/** | |
* Implements hook_preprocess_entity(). | |
*/ | |
function wj_profile_preprocess_entity(&$vars) { | |
switch ($vars['entity_type']) { | |
case 'profile2': | |
$vars['theme_hook_suggestions'][] = "profile2__profile__{$vars['view_mode']}"; | |
$function_name = "wj_profile_preprocess_profile2_profile_{$vars['view_mode']}"; | |
if (function_exists($function_name)) { |
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
class CodesController < ApplicationController | |
def index | |
@codes = Code.all | |
respond_to do |format| | |
format.html | |
format.json do | |
render json: @codes, | |
only: [:id, :name, :description] | |
end |
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
<?php | |
$baz = $qux = t('Arguments'); | |
$bar = array(); | |
foreach (module_implements('foo') as $module) { | |
$bar[] = module_invoke($module, 'foo', $baz, $qux); | |
} | |
# module_invoke_all('foo', $baz, $qux); |
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
class Code < ActiveRecord::Base | |
attr_accessor :value | |
def value | |
'hello' | |
end | |
end |
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
<?php | |
/** | |
* Implements hook_entity_info_alter(). | |
*/ | |
function foo_entity_info_alter(&$entity_info) { | |
$entity_info['node']['view modes']['another_teaser'] = array( | |
'label' => t('Another teaser'), | |
'custom settings' => TRUE, | |
); |
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
[{"id":1,"name":"X99.7","description":"Not known","value":"X99.7"},{"id":2,"name":"X99.8","description":"Outpatient procedure carried out but no appropriate OPCS-4 code available","value":"X99.8"},{"id":3,"name":"X99.9","description":"No outpatient procedure carried out","value":"X99.9"},{"id":4,"name":"A01.3","description":"Partial lobectomy of brain","value":"A01.3"},{"id":5,"name":"A01.8","description":"Other specified major excision of tissue of brain","value":"A01.8"},{"id":6,"name":"A01.9","description":"Unspecified major excision of tissue of brain","value":"A01.9"},{"id":7,"name":"A02.4","description":"Excision of lesion of tissue of occipital lobe of brain","value":"A02.4"},{"id":8,"name":"A02.5","description":"Excision of lesion of tissue of cerebellum","value":"A02.5"},{"id":9,"name":"A03.4","description":"Stereotactic ablation of tissue of brain stem","value":"A03.4"},{"id":10,"name":"A03.9","description":"Unspecified stereotactic ablation of tissue of brain","value":"A03.9"},{"id":11,"name":"A04. |
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
<?php | |
ctools_include('ajax'); | |
ctools_include('modal'); | |
ctools_modal_add_js(); | |
drupal_add_library('module', 'fancybox.modal'); // Include js here. | |
$path = 'some_path/nojs'; | |
$content = ctools_modal_text_button($text, $path, '', $class); |
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
<?php | |
/** | |
* Implements hook_rules_event_info(). | |
*/ | |
function hook_rules_event_info() { | |
return array( | |
'list_of_users' => array( | |
'label' => t('List of users example'), | |
'group' => t('Example'), | |
'variables' => array( |