I am working on a view for a list of course which outputs course names, numbers and days. I have a set of values for days (i.e Monday, Tuesday,..) and I have grouped them so that they show in one table cell (DAYS). I would like to trim them so that instead of Monday they would appear as MON. When I enable trimming, it works fine on one item, but those that are grouped (a row with more than one day ex. Monday Tuesday) it doesn't output anything. It looks like a bug to me.

Cheers

Comments

puya’s picture

Here's the Views Code with 2 instances of the desired values. first on is normal and the second one is trimed:

$view = new view;
$view->name = 'fullcourses';
$view->description = 'Courses page';
$view->tag = 'fullcourses';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 1,
      'max_length' => '40',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'field_course_number_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'default',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_course_number_value',
    'table' => 'node_data_field_course_number',
    'field' => 'field_course_number_value',
    'relationship' => 'none',
  ),
  'field_course_days_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '3',
      'word_boundary' => 0,
      'ellipsis' => 0,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'trimmed',
    'multiple' => array(
      'group' => 1,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => 0,
    ),
    'exclude' => 0,
    'id' => 'field_course_days_value',
    'table' => 'node_data_field_course_days',
    'field' => 'field_course_days_value',
    'relationship' => 'none',
  ),
  'field_course_start_time_value' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'time',
    'multiple' => array(
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_to' => '',
      'group' => TRUE,
    ),
    'repeat' => array(
      'show_repeat_rule' => '',
    ),
    'fromto' => array(
      'fromto' => 'both',
    ),
    'exclude' => 0,
    'id' => 'field_course_start_time_value',
    'table' => 'node_data_field_course_start_time',
    'field' => 'field_course_start_time_value',
    'relationship' => 'none',
  ),
  'field_course_days_value_1' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 1,
      'max_length' => '3',
      'word_boundary' => 0,
      'ellipsis' => 0,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'link_to_node' => 0,
    'label_type' => 'none',
    'format' => 'default',
    'multiple' => array(
      'group' => 1,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => 0,
    ),
    'exclude' => 0,
    'id' => 'field_course_days_value_1',
    'table' => 'node_data_field_course_days',
    'field' => 'field_course_days_value',
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'field_course_number_value' => array(
    'order' => 'ASC',
    'delta' => -1,
    'id' => 'field_course_number_value',
    'table' => 'node_data_field_course_number',
    'field' => 'field_course_number_value',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'uid' => array(
    'id' => 'uid',
    'table' => 'users',
    'field' => 'uid',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type_1' => array(
    'operator' => 'in',
    'value' => array(
      'course' => 'course',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type_1',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
  'grouping' => '',
  'override' => 1,
  'sticky' => 0,
  'order' => 'asc',
  'columns' => array(
    'title' => 'title',
    'field_course_number_value' => 'field_course_number_value',
    'field_course_hours_value' => 'field_course_hours_value',
    'field_course_days_value' => 'field_course_days_value',
  ),
  'info' => array(
    'title' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'field_course_number_value' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'field_course_hours_value' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'field_course_days_value' => array(
      'separator' => '',
    ),
  ),
  'default' => '-1',
));
$handler->override_option('row_options', array(
  'inline' => array(
    'title' => 'title',
    'field_course_days_value' => 'field_course_days_value',
    'field_course_hours_value' => 'field_course_hours_value',
    'field_course_number_value' => 'field_course_number_value',
  ),
  'separator' => ' ',
));
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', 'Courses block');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'Block', 'block_2');
$handler->override_option('arguments', array(
  'uid' => array(
    'default_action' => 'default',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'breadcrumb' => '',
    'default_argument_type' => 'user',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'break_phrase' => 0,
    'not' => 0,
    'id' => 'uid',
    'table' => 'users',
    'field' => 'uid',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '3' => 0,
      '6' => 0,
      '5' => 0,
      '8' => 0,
      '7' => 0,
      '4' => 0,
    ),
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 1,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'course' => 0,
      'event' => 0,
      'news' => 0,
      'page' => 0,
      'profile' => 0,
      'publication' => 0,
      'research' => 0,
      'story' => 0,
      'student_project' => 0,
      'top_header_banner_image' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '2' => 0,
      '3' => 0,
      '1' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'validate_argument_php' => '',
  ),
));
$handler->override_option('block_description', 'Courses : Each Faculty');
$handler->override_option('block_caching', -1);

merlinofchaos’s picture

Status: Active » Fixed

Actually, it's not really a bug. As far as Views is concerned, all of the items together are one field.

However, in the dev version of Views just yesterday I checked in a feature that will allow multiple items to use that kind of feature. However, it will require modules that use that particular style to update their objects, and I doubt CCK is updated yet, and I'm not sure when they even will.

puya’s picture

Thanks Merlin, do you think I should open and issue on CCK requesting for the particular styling of objects which you mentioned? (I don't know the details though)

puya’s picture

Thanks Merlin, do you think I should open and issue on CCK requesting for the particular styling of objects which you mentioned? (I don't know the details though)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.