function commons_answers_views_default_views_alter in Drupal Commons 6.2
Implementation of hook_views_default_views_alter().
File
- modules/
features/ commons_answers/ commons_answers.module, line 64
Code
function commons_answers_views_default_views_alter(&$views) {
// Alter the default questions_answers view to always include the footer
// that contains our "Add an answer" form.
if (!empty($views['question_answers'])) {
$views['question_answers']->display['default']->display_options['footer_format'] = '1';
$views['question_answers']->display['default']->display_options['footer_empty'] = 1;
$views['question_answers']->display['default']->display_options['empty'] = ' ';
$views['question_answers']->display['default']->display_options['empty_format'] = '1';
$views['question_answers']->display['node_content_1']->display_options['show_empty'] = 1;
}
// Display a '0' when no questions have been answered and use the
// 'small' date format.
foreach (array(
'all_questions',
'user_questions',
) as $view_id) {
if (!empty($views[$view_id])) {
$views[$view_id]->display['default']->display_options['fields']['created']['date_format'] = 'small';
$views[$view_id]->display['default']->display_options['fields']['field_answer_count_value']['empty'] = '0';
$views[$view_id]->display['default']->display_options['fields']['field_answer_count_value']['empty_zero'] = 0;
$views[$view_id]->display['default']->display_options['fields']['field_answer_count_value']['hide_alter_empty'] = 0;
}
}
}