本文整理汇总了PHP中taxonomy_vocabulary_load函数的典型用法代码示例。如果您正苦于以下问题:PHP taxonomy_vocabulary_load函数的具体用法?PHP taxonomy_vocabulary_load怎么用?PHP taxonomy_vocabulary_load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了taxonomy_vocabulary_load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newsweek_preprocess_ibtg_article_archive
function newsweek_preprocess_ibtg_article_archive(&$vars)
{
$vocabulary_name = '';
if (arg(0) == "taxonomy" && arg(1) == "term" && is_numeric(arg(2))) {
$term = taxonomy_term_load(arg(2));
$vocabulary = taxonomy_vocabulary_load($term->vid);
$vocabulary_name = $vocabulary->machine_name;
}
$c = 0;
$active_contexts = context_active_contexts();
foreach ($vars['nodes'] as $node) {
$c++;
if ($c <= 2 && !empty($vocabulary_name) && ($vocabulary_name == "categories" || array_key_exists('green_section_page', $active_contexts))) {
$node->view_mode = 'teaser';
} else {
$node->view_mode = 'small_teaser';
}
}
if ($vocabulary_name == "categories" || array_key_exists('green_section_page', $active_contexts)) {
$vars['rss_link'] = url('rss/' . strtolower($term->name));
}
if (arg(0) == 'newsfeed') {
$vars['rss_link'] = url('rss');
}
$vars['archive_list_style'] = newsweek_set_archive_list_style();
}
示例2: arg
<?php
if ($rows or $empty) {
?>
<div class="view-content">
<?php
$team_forum_id = arg(4);
$team_forum = boincteam_forum_load($team_forum_id);
// Grab a sample forum topic node to get the forum vocabulary name
$sample = db_result(db_query("\n SELECT nid FROM {node} WHERE type = 'forum' LIMIT 1"));
$forum_node = node_load($sample);
// Get vocabulary name and use that as the page title
$taxonomy = taxonomy_get_term($forum_node->tid);
if (module_exists('internationalization')) {
$taxonomy = reset(i18ntaxonomy_localize_terms(array($taxonomy)));
}
if ($forum_vocab = taxonomy_vocabulary_load($taxonomy->vid)) {
if (module_exists('internationalization')) {
$forum_vocab->name = i18ntaxonomy_translate_vocabulary_name($forum_vocab);
}
drupal_set_title($forum_vocab->name);
}
?>
<h1 class="title"><?php
print $forum_vocab->name;
?>
</h1>
<div id="forum">
<h2 class="title">
<?php
示例3: getFormSchemaAllowedValues
/**
* Overrides RestfulEntityBase::getFormSchemaAllowedValues().
*
* For OG vocab fields we get only the ones of the group passed context.
*/
protected function getFormSchemaAllowedValues($field)
{
if ($field['field_name'] == 'c4m_related_document') {
// We don't need allowed values for related documents, because we are
// getting them from library.
return array();
}
if ($field['field_name'] != OG_VOCAB_FIELD) {
return parent::getFormSchemaAllowedValues($field);
}
$request = $this->getRequest();
if (empty($request['group']) || !intval($request['group'])) {
throw new \RestfulBadRequestException('The "group" parameter is missing for the request, thus the vocabulary cannot be set for the group.');
}
$node = node_load($request['group']);
if (!$node) {
throw new \RestfulBadRequestException('The "group" parameter is not a node.');
} elseif ($node->type != 'group') {
throw new \RestfulBadRequestException('The "group" parameter is not a of type "group".');
}
$return = array();
foreach (array('tags', 'categories') as $vocab_name) {
$allowed_values = array();
$og_vocab = c4m_restful_get_og_vocab_by_name('node', $node->nid, $vocab_name);
$vocab = taxonomy_vocabulary_load($og_vocab[0]->vid);
$allowed_values[] = array('vocabulary' => $vocab->machine_name, 'parent' => 0);
$field['settings']['allowed_values'] = $allowed_values;
$return[$vocab_name] = taxonomy_allowed_values($field);
}
return $return;
}
示例4: hook_mail
/**
* Prepare a message based on parameters; called from drupal_mail().
*
* Note that hook_mail(), unlike hook_mail_alter(), is only called on the
* $module argument to drupal_mail(), not all modules.
*
* @param $key
* An identifier of the mail.
* @param $message
* An array to be filled in. Elements in this array include:
* - id: An ID to identify the mail sent. Look at module source code
* or drupal_mail() for possible id values.
* - to: The address or addresses the message will be sent to. The formatting
* of this string will be validated with the
* @link http://php.net/manual/filter.filters.validate.php PHP e-mail validation filter. @endlink
* - subject: Subject of the e-mail to be sent. This must not contain any
* newline characters, or the mail may not be sent properly. drupal_mail()
* sets this to an empty string when the hook is invoked.
* - body: An array of lines containing the message to be sent. Drupal will
* format the correct line endings for you. drupal_mail() sets this to an
* empty array when the hook is invoked.
* - from: The address the message will be marked as being from, which is
* set by drupal_mail() to either a custom address or the site-wide
* default email address when the hook is invoked.
* - headers: Associative array containing mail headers, such as From,
* Sender, MIME-Version, Content-Type, etc. drupal_mail() pre-fills
* several headers in this array.
* @param $params
* An array of parameters supplied by the caller of drupal_mail().
*/
function hook_mail($key, &$message, $params)
{
$account = $params['account'];
$context = $params['context'];
$variables = array('%site_name' => variable_get('site_name', 'Drupal'), '%username' => format_username($account));
if ($context['hook'] == 'taxonomy') {
$entity = $params['entity'];
$vocabulary = taxonomy_vocabulary_load($entity->vid);
$variables += array('%term_name' => $entity->name, '%term_description' => $entity->description, '%term_id' => $entity->tid, '%vocabulary_name' => $vocabulary->name, '%vocabulary_description' => $vocabulary->description, '%vocabulary_id' => $vocabulary->vid);
}
// Node-based variable translation is only available if we have a node.
if (isset($params['node'])) {
$node = $params['node'];
$variables += array('%uid' => $node->uid, '%node_url' => url('node/' . $node->nid, array('absolute' => TRUE)), '%node_type' => node_type_get_name($node), '%title' => $node->title, '%teaser' => $node->teaser, '%body' => $node->body);
}
$subject = strtr($context['subject'], $variables);
$body = strtr($context['message'], $variables);
$message['subject'] .= str_replace(array("\r", "\n"), '', $subject);
$message['body'][] = drupal_html_to_text($body);
}
示例5: get_keywords_for
/**
* Get a list of tags for a piece of content
*
* @return Array an array of terms or empty array
*/
public static function get_keywords_for($node)
{
$terms = array();
if (!db_table_exists('taxonomy_index')) {
return $terms;
}
$results = db_query('SELECT tid FROM {taxonomy_index} WHERE nid = :nid', array(':nid' => $node->nid));
foreach ($results as $result) {
$term = taxonomy_term_load($result->tid);
if (empty($term) || empty($term->name)) {
continue;
}
array_push($terms, ShareaholicUtilities::clean_string($term->name));
$vocabulary = taxonomy_vocabulary_load($term->vid);
if (empty($vocabulary) || empty($vocabulary->name) || preg_match('/tags/i', $vocabulary->name)) {
continue;
}
array_push($terms, ShareaholicUtilities::clean_string($vocabulary->name));
}
$terms = array_unique($terms);
return $terms;
}
示例6: taxonomy_vocabulary_load
* - $classes_array: Array of html class attribute values. It is flattened
* into a string within the variable $classes.
* - $block_zebra: Outputs 'odd' and 'even' dependent on each block region.
* - $zebra: Same output as $block_zebra but independent of any block region.
* - $block_id: Counter dependent on each block region.
* - $id: Same output as $block_id but independent of any block region.
* - $is_front: Flags true when presented in the front page.
* - $logged_in: Flags true when the current user is a logged-in member.
* - $is_admin: Flags true when the current user is an administrator.
*
* @see template_preprocess()
* @see template_preprocess_block()
* @see template_process()
*/
if ($block->delta == 'categories') {
$vocabulary = taxonomy_vocabulary_load(COMMERCEBOX_CATALOG_VID);
if ($vocabulary) {
$block->subject = '';
$block->content = taxonomy_block_build_taxonomy_tree(COMMERCEBOX_CATALOG_VID);
$content = category_generate_term_list($block->content, FALSE);
}
}
/**
* Hierarchcal list of terms
*/
function category_generate_term_list($hierarchy)
{
$items = array();
foreach ($hierarchy as $term) {
$title = $term->name;
$item = l($title, 'catalog/' . $term->tid);
示例7: return_terms_from_vocabulary
function return_terms_from_vocabulary($node, $vid)
{
$terms = taxonomy_node_get_terms_by_vocabulary($node, $vid, $key = 'tid');
// $vocabolary = taxonomy_get_vocabulary($vid);
$vocabolary = taxonomy_vocabulary_load($vid);
// $content ='<div class="vocabolary_terms">';
// $content .='<div class="vocabolary">'.$vocabolary->name.'</div>';
$termslist = '';
if ($terms) {
$content .= '<div class="terms">';
foreach ($terms as $term) {
$termslist = $termslist . l($term->name, 'taxonomy/term/' . $term->tid) . ' | ';
// $termslist = $termslist .$term->name .' | ';
}
$content .= trim($termslist, " |") . '</div>';
}
// $content.='</div>';
return $content;
}
示例8: _objectLoad
/**
* (non-PHPdoc)
* @see Yamm_EntityAbstract::_objectLoad()
*/
protected function _objectLoad($vid)
{
return taxonomy_vocabulary_load((int) $vid);
}
示例9: process
/**
* {@inheritdoc}
*
* Change the bundle on the fly, based on a parameter send in the request.
*/
public function process($path = '', array $request = array(), $method = \RestfulInterface::GET, $check_rate_limit = TRUE)
{
if (empty($request['account']) || !intval($request['account'])) {
throw new \RestfulBadRequestException('The "account" parameter is missing for the request, thus the vocabulary cannot be set for the account.');
}
// Get the account node.
$node = node_load($request['account']);
if (!$node) {
throw new \RestfulBadRequestException('The "account" parameter is not a node.');
} elseif ($node->type != 'account') {
throw new \RestfulBadRequestException('The "account" parameter is not a of type "account".');
}
// Get an array of OG vocabularies for the account.
$og_vocabs = og_vocab_relation_get_by_group('node', $node->nid);
if (empty($og_vocabs)) {
throw new \RestfulBadRequestException('No vocabulary is given for the specified account.');
}
// Get the meter-category taxonomy
$found = FALSE;
foreach ($og_vocabs as $og_vocab) {
$vocabulary = taxonomy_vocabulary_load($og_vocab->vid);
if (strpos($vocabulary->machine_name, 'meter_category_') === FALSE) {
// Not a meter-category vocabulary, skip.
continue;
}
$found = TRUE;
$taxonomy = taxonomy_vocabulary_load($og_vocab->vid);
$this->bundle = $taxonomy->machine_name;
// Loop no more.
break;
}
if (!$found) {
throw new \RestfulBadRequestException('No meter-category vocabulary was found.');
}
// Remove account ID from the request because it's not a field in the taxonomy.
unset($request['account']);
return parent::process($path, $request, $method, $check_rate_limit);
}
示例10: _bvng_get_more_search_options
function _bvng_get_more_search_options($tid = NULL, $search_string = NULL)
{
$env = variable_get('environment_settings');
$data_portal_base_url = $env['data_portal_base_url'];
$term = taxonomy_term_load($tid);
$voc = taxonomy_vocabulary_load($term->vid);
$links = '<p>' . t('This search result only covers the text content of the news and information pages of the GBIF portal.') . '</p>';
$links .= '<p>' . t('If you want to search data content, start here:') . '</p>';
$links .= '<ul class="filter-list">';
// Publishers and datasets
$link_text = t('Publishers and datasets');
if ($tid !== NULL) {
$path_dataset = $data_portal_base_url . '/dataset/search?q=' . $term->name;
} elseif ($search_string !== NULL) {
$path_dataset = $data_portal_base_url . '/dataset/search?q=' . $search_string;
}
$links .= '<li>' . l($link_text, $path_dataset) . '</li>';
// Countries
if ($voc->machine_name == 'countries') {
$iso2 = field_get_items('taxonomy_term', $term, 'field_iso2');
$path_country = $data_portal_base_url . '/country/' . $iso2[0]['value'];
$link_text = t('Country') . '(' . $term->name . ')';
} else {
$link_text = t('Countries');
$path_country = $data_portal_base_url . '/country';
}
$links .= '<li>' . l($link_text, $path_country) . '</li>';
// Occurrences
$link_text = t('Occurrences');
$path_occurrence = $data_portal_base_url . '/occurrence';
$links .= '<li>' . l($link_text, $path_occurrence) . '</li>';
// Species
$link_text = t('Species');
$path_species = $data_portal_base_url . '/species';
$links .= '<li>' . l($link_text, $path_species) . '</li>';
$links .= '</ul>';
return $links;
}
示例11: bootstrap_theme_dashboard_contribute_create_form_submit
function bootstrap_theme_dashboard_contribute_create_form_submit(&$form, &$form_state)
{
global $user;
$contribution = new stdClass();
$contribution->type = NODE_TYPE_CLAS_CONTRIBUTOR;
$contribution->status = NODE_NOT_PUBLISHED;
$contribution->language = LANGUAGE_NONE;
$contribution->uid = $user->uid;
$term = taxonomy_term_load($form_state['values']['cno_learning_object_type']);
$termname = $term->name;
if (!empty($form_state['values']['cno_associated_materials'])) {
$file = file_load($form_state['values']['cno_associated_materials']);
} else {
$file = file_managed_file_save_upload($form['cno_associated_materials']);
}
if (!empty($form_state['values']['cnob_photo'])) {
$photo = file_load($form_state['values']['cnob_photo']);
} else {
$photo = file_managed_file_save_upload($form['cnob_photo']);
}
if ($termname == 'Audio') {
if (!empty($form_state['values']['cno_lobj_res_audio'])) {
$audio_file = file_load($form_state['values']['cno_lobj_res_audio']);
//$fname_arr = explode("://",$audio_file->uri);
//file_move($audio_file, "public://".$fname_arr[1], FILE_EXISTS_RENAME);
$contribution->field_cnob_learn_obj_res_audio[$contribution->language][0] = array('fid' => $audio_file->fid, 'display' => 1);
} else {
$audio_file = file_managed_file_save_upload($form['cno_lobj_res_audio']);
}
}
/*if (!empty($form_state['values']['cno_lobj_res_video'])) {
$video_file = file_load($form_state['values']['cno_lobj_res_video']);
$contribution->field_cnob_learn_obj_res_video[$contribution->language][0] = array('fid' => $video_file->fid,'display' => 1);
} else {
$video_file = file_managed_file_save_upload($form['cno_lobj_res_video']);
}*/
if ($termname == 'Document') {
if (!empty($form_state['values']['cno_lobj_res_document'])) {
$doc_file = file_load($form_state['values']['cno_lobj_res_document']);
$contribution->field_cnob_learn_obj_res_doc[$contribution->language][0] = array('fid' => $doc_file->fid, 'display' => 1);
} else {
$doc_file = file_managed_file_save_upload($form['cno_lobj_res_document']);
}
}
if ($termname == 'Link') {
if (!empty($form_state['values']['cno_lobj_res_link'])) {
$res_link = $form_state['values']['cno_lobj_res_link'];
} else {
$res_link = '';
}
$contribution->field_cnob_learn_obj_res_link[$contribution->language][0]['value'] = $res_link;
}
$contribution->title = $form_state['values']['title'];
$contribution->body[$contribution->language][0]['value'] = $form_state['values']['body'];
$contribution->field_cnob_user_type[$contribution->language][0]['value'] = $form_state['values']['cno_type'];
$contribution->field_cnob_category[$contribution->language][0]['tid'] = $form_state['values']['cno_category'];
$contribution->field_cnob_learning_object_type[$contribution->language][0]['tid'] = $form_state['values']['cno_learning_object_type'];
if ($termname == 'Video') {
$contribution->field_cnob_learn_obj_res_video[$contribution->language][0]['video_url'] = $form_state['values']['cno_lobj_res_video'];
}
$contribution->field_cnob_area_of_study[$contribution->language][0]['tid'] = $form_state['values']['cno_area_of_study'];
$contribution->field_cnob_grade_level[$contribution->language][0]['tid'] = $form_state['values']['cno_grade_level'];
$contribution->field_cnob_expiration_date[$contribution->language][0]['value'] = date('Y-m-d', strtotime($form_state['values']['expiration_date']));
$contribution->field_cnob_collections[$contribution->language][0]['nid'] = $form_state['values']['og_group_ref'];
$contribution->og_group_ref[$contribution->language][0]['target_id'] = $form_state['values']['og_group_ref'];
$contribution->field_cnob_content_area[$contribution->language][0] = array('tid' => $form_state['values']['cno_content_area']);
$contribution->group_content_access[$contribution->language][0]['value'] = OG_CONTENT_ACCESS_PRIVATE;
$contribution->cnob_content_area[$contribution->language][0]['value'] = OG_CONTENT_ACCESS_PRIVATE;
//$contribution->field_cnob_relevant_standards[$contribution->language][0]['tid'] = $form_state['values']['cno_relevant_standards'];
$contribution->field_cnob_lesson_plan[$contribution->language][0]['value'] = $form_state['values']['lesson_plan'];
$contribution->field_cnob_assigned_badge[$contribution->language][0]['value'] = $form_state['values']['cno_badge'];
if ($file) {
$contribution->field_cnob_associated_materials[$contribution->language][0] = array('fid' => $file->fid, 'display' => 1);
}
if ($photo) {
$contribution->field_cnob_photo[$contribution->language][0] = array('fid' => $photo->fid, 'display' => 1);
}
$contribution->field_cnob_comments[$contribution->language][0]['value'] = $form_state['values']['comments'];
//////Tags////
$tags = $form_state['values']['tags'];
$typed_terms = drupal_explode_tags($tags);
$tags_vocabulary = taxonomy_vocabulary_load(TAXONOMY_VOCABULARY_ID_TAGS);
$value_tags = array();
foreach ($typed_terms as $typed_term) {
if ($possibilities = taxonomy_term_load_multiple(array(), array('name' => trim($typed_term), 'vid' => array(TAXONOMY_VOCABULARY_ID_TAGS)))) {
$term = array_pop($possibilities);
} else {
$vocabulary = $tags_vocabulary;
$term = array('tid' => 'autocreate', 'vid' => $vocabulary->vid, 'name' => $typed_term, 'vocabulary_machine_name' => $vocabulary->machine_name);
}
$value_tags[] = (array) $term;
}
$contribution->field_cnob_tags[$contribution->language] = $value_tags;
//////Tags////
//////Relevant Standards////
$relevant_standards = $form_state['values']['cno_relevant_standards'];
$typed_terms = drupal_explode_tags($relevant_standards);
$rs_vocabulary = taxonomy_vocabulary_load(TAXONOMY_VOCABULARY_ID_RELEVANT_STANDARDS);
$value_rs = array();
foreach ($typed_terms as $typed_term) {
//.........这里部分代码省略.........
示例12: nys_get_comma_tax_list
function nys_get_comma_tax_list($vars)
{
if (arg(0) == 'committee') {
$schema = 'committee/' . check_plain(arg(1)) . '/issues/';
} else {
if (!empty($vars['senator'])) {
$schema = 'senator/' . nyss_senator_title_to_url($vars['senator']) . '/issues/';
} else {
$schema = FALSE;
}
}
if (empty($vars['node']->taxonomy)) {
return;
}
foreach ($vars['node']->taxonomy as $taxonomy) {
if ($schema) {
$terms[$taxonomy->vid][$taxonomy->tid] = l($taxonomy->name, $schema . strtolower(str_replace(' ', '_', check_plain($taxonomy->name))));
} else {
$terms[$taxonomy->vid][$taxonomy->tid] = l($taxonomy->name, 'taxonomy/term/' . $taxonomy->tid);
}
}
$tax_terms_output = '<ul>';
foreach ($terms as $vid => $terms) {
$vocabulary = taxonomy_vocabulary_load($vid);
$vocab_name = check_plain($vocabulary->name);
$tax_terms_output .= '<li class="' . strtolower(str_replace(' ', '_', $vocab_name)) . '">';
$tax_terms_output .= '<label>' . $vocab_name . '</label>';
$tax_terms_output .= '<span class="term_list">' . implode(', ', $terms) . '</span>';
$tax_terms_output .= '</li>';
}
$tax_terms_output .= '</ul>';
return $tax_terms_output;
}
示例13: require_login
<?php
require_once '../../../config.php';
require_once '../lib.php';
require_login();
$id = required_param('id', PARAM_INT);
// Vocabulary id.
$delete = optional_param('delete', '', PARAM_ALPHANUM);
// Delete confirmation hash.
$context = context_system::instance();
$PAGE->set_context($context);
$PAGE->set_url('/local/taxonomy/forms/VocabularyDeletePage.php', array('id' => $id));
$PAGE->set_pagelayout('standard');
$PAGE->set_heading(get_string('editvocabulary', 'local_taxonomy'));
$site = get_site();
if (!($vocabulary = taxonomy_vocabulary_load($id))) {
print_error("vocabulary:notfound", "local_taxonomy");
}
$PAGE->set_title($site->fullname);
$PAGE->navbar->add(get_string('navbartaxonomy', 'local_taxonomy'), new moodle_url('/local/taxonomy/index.php'));
$vocabularyshortname = $vocabulary->shortname;
if (!$delete) {
$strdeletecheck = get_string("deletecheck", "", $vocabulary->name);
$strdeletecoursecheck = get_string("vocabulary:delete:confirm", 'local_taxonomy');
$PAGE->navbar->add($strdeletecheck);
$PAGE->set_title("{$site->shortname}: {$strdeletecheck}");
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
$message = "{$strdeletecoursecheck}<br/><br/><b style=\"margin-left:80px;\">" . $vocabulary->name . "</b>";
echo $OUTPUT->confirm($message, "VocabularyDeletePage.php?id={$vocabulary->id}&delete=" . md5($vocabulary->shortname), "/local/taxonomy/index.php");
echo $OUTPUT->footer();
示例14: optional_param
* @category forms
* @link http://docs.moodle.org/dev/Form_API
* @copyright 2014 MoodleMootFr
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once '../../../config.php';
require_once '../lib.php';
$context = context_system::instance();
$PAGE->set_context($context);
$id = optional_param('id', 0, PARAM_INT);
// Vocabulary id.
$PAGE->set_url('/local/taxonomy/forms/VocabularyEditPage.php', array('id' => $id));
$PAGE->set_pagelayout('standard');
$PAGE->set_heading(get_string('editvocabulary', 'local_taxonomy'));
require_once './VocabularyEditForm.php';
$vocabulary = taxonomy_vocabulary_load($id);
$form = new VocabularyEditForm(NULL, array('vocabulary' => $vocabulary));
//Form processing and displaying is done here
if ($form->is_cancelled()) {
//Handle form cancel operation, if cancel button is present on form
$url = new moodle_url($CFG->wwwroot . '/local/taxonomy/index.php');
redirect($url);
} else {
if ($data = $form->get_data()) {
if (empty($vocabulary->id)) {
// create
$vocabulary = taxonomy_vocabulary_create($data);
} else {
// edit
$vocabulary = taxonomy_vocabulary_update($data);
}
示例15: hwpi_basetheme_node_view_alter
//.........这里部分代码省略.........
$build['field_email'][0]['#markup'] = '<a href="mailto:' . $email_plain . '">' . $email_plain . '</a>';
}
// Newlines after website.
if (isset($build['pic_bio']['field_website'])) {
foreach (array_filter(array_keys($build['pic_bio']['field_website']), 'is_numeric') as $delta) {
$item = $build['pic_bio']['field_website']['#items'][$delta];
$build['pic_bio']['field_website'][$delta]['#markup'] = l($item['title'], $item['url'], $item) . '<br />';
}
}
unset($build['links']['node']);
return;
}
// Professional titles
if (isset($build['field_professional_title'])) {
$build['field_professional_title']['#label_display'] = 'hidden';
$build['field_professional_title']['#weight'] = -10;
}
if (isset($build['field_person_photo'])) {
$build['field_person_photo']['#label_display'] = 'hidden';
$build['pic_bio']['field_person_photo'] = $build['field_person_photo'];
unset($build['field_person_photo']);
}
$children = element_children($build['pic_bio']);
if (empty($children)) {
$build['pic_bio']['#access'] = false;
}
// Note that Contact and Website details will print wrappers and titles regardless of any field content.
// This is kind of deliberate to avoid having to handle the complexity of dealing with the layout or
// setting messages etc.
$block_zebra = 0;
// Contact Details
if ($build['#view_mode'] != 'sidebar_teaser') {
$build['contact_details']['#prefix'] = '<div class="block contact-details ' . ($block_zebra++ % 2 ? 'even' : 'odd') . '"><div class="block-inner"><h2 class="block-title">Contact Information</h2>';
$build['contact_details']['#suffix'] = '</div></div>';
$build['contact_details']['#weight'] = -8;
// Contact Details > address
if (isset($build['field_address'])) {
$build['field_address']['#label_display'] = 'hidden';
$build['contact_details']['field_address'] = $build['field_address'];
$build['contact_details']['field_address'][0]['#markup'] = str_replace("\n", '<br>', $build['contact_details']['field_address'][0]['#markup']);
unset($build['field_address']);
}
// Contact Details > email
if (isset($build['field_email'])) {
$build['field_email']['#label_display'] = 'inline';
$email_plain = mb_strtolower($build['field_email'][0]['#markup']);
if ($email_plain) {
$build['field_email'][0]['#markup'] = l($email_plain, 'mailto:' . $email_plain, array('absolute' => TRUE));
}
$build['contact_details']['field_email'] = $build['field_email'];
$build['contact_details']['field_email']['#weight'] = -50;
unset($build['field_email']);
}
// Contact Details > phone
if (isset($build['field_phone'])) {
$build['field_phone']['#label_display'] = 'hidden';
$phone_plain = $build['field_phone'][0]['#markup'];
if ($phone_plain) {
$build['field_phone'][0]['#markup'] = t('p: ') . $phone_plain;
}
$build['contact_details']['field_phone'] = $build['field_phone'];
$build['contact_details']['field_phone']['#weight'] = 50;
unset($build['field_phone']);
}
// Websites
if (isset($build['field_website'])) {
$build['website_details']['#prefix'] = '<div class="block website-details ' . ($block_zebra++ % 2 ? 'even' : 'odd') . '"><div class="block-inner"><h2 class="block-title">Websites</h2>';
$build['website_details']['#suffix'] = '</div></div>';
$build['website_details']['#weight'] = -7;
$build['field_website']['#label_display'] = 'hidden';
$build['website_details']['field_website'] = $build['field_website'];
unset($build['field_website']);
}
//Don't show an empty contact details section.
if (!element_children($build['contact_details'])) {
unset($build['contact_details']);
}
}
if (isset($build['og_vocabulary'])) {
$terms = array();
foreach ($build['og_vocabulary']['#items'] as $i) {
if (isset($i['target_id'])) {
$terms[] = $i['target_id'];
} else {
$terms[] = $i;
}
}
$terms = vsite_vocab_sort_weight_alpha(taxonomy_term_load_multiple($terms));
foreach ($terms as $info) {
$v = taxonomy_vocabulary_load($info['vid']);
if (!isset($build[$v->machine_name])) {
$m = $v->machine_name;
$build[$m] = array('#type' => 'container', '#weight' => $block_zebra, '#attributes' => array('class' => array('block', $m, $block_zebra++ % 2 ? 'even' : 'odd')), 'inner' => array('#type' => 'container', '#attributes' => array('class' => array('block-inner')), 'title' => array('#markup' => '<h2 class="block-title">' . $v->name . '</h2>')));
}
$build[$v->machine_name]['inner'][$info['tid']] = array('#prefix' => '<div>', '#suffix' => '</div>', '#theme' => 'link', '#path' => $info['uri'], '#text' => $info['term'], '#options' => array('attributes' => array(), 'html' => false));
}
unset($build['og_vocabulary']);
}
}
}