I am trying to use views to create a block holding certain feed content however views seems to strip HTML from the feeds decription nodes. Is there any way around this? In the aggregator settings I can set which HTML tags are allowed in but once it hits Views its seems to all get stripped out anyway...

Comments

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

You need to be very specific. Attaching an export of the view might help, but you need to say which fields you're using, to start with, and precise instructions to get into the situation you're doing. Views has a LOT of options, and I am not going to guess which ones you're using.

beauz’s picture

Here's an export of the view:

$view = new view;
$view->name = 'news_rss';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'aggregator_item';
$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' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'display_as_link' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'aggregator_item',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'timestamp' => 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,
    ),
    'date_format' => 'large',
    'custom_date_format' => '',
    'exclude' => 0,
    'id' => 'timestamp',
    'table' => 'aggregator_item',
    'field' => 'timestamp',
    'relationship' => 'none',
  ),
  'description' => 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,
    ),
    'exclude' => 0,
    'id' => 'description',
    'table' => 'aggregator_item',
    'field' => 'description',
    'relationship' => 'none',
  ),
  'link' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 1,
      'text' => 'Read more',
      'make_link' => 1,
      'path' => '[link]',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'display_as_link' => 1,
    'exclude' => 0,
    'id' => 'link',
    'table' => 'aggregator_item',
    'field' => 'link',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('sorts', array(
  'timestamp' => array(
    'order' => 'DESC',
    'granularity' => 'second',
    'id' => 'timestamp',
    'table' => 'aggregator_item',
    'field' => 'timestamp',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'fid' => array(
    'operator' => '=',
    'value' => array(
      'value' => '1',
      'min' => '',
      'max' => '',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'fid',
    'table' => 'aggregator_feed',
    'field' => 'fid',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('title', 'Courier Mail Turf Feed');
$handler->override_option('use_more', 1);
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
dawehner’s picture

Status: Postponed (maintainer needs more info) » Active

Currently it is used filter_xss for the description. So there should be a custom field handler, which reads out the settings from aggregator and display it.

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new1.68 KB

here is it

sarhugo’s picture

Patch works.
One improvement: instead of repeat the logic on the handler's render function it's best to just call aggregator_filter_xss on it:

  function render($values) {
    $value = $values->{$this->field_alias};
    return aggregator_filter_xss($value);
  }
dawehner’s picture

Very good idea!

merlinofchaos’s picture

Can we get an updated patch with the change from #5?

dawehner’s picture

StatusFileSize
new1.52 KB

here it is:

merlinofchaos’s picture

Version: 6.x-2.7 » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)

Commited to all 6.x branches. Does not apply to 7.x -- needs porting.

dawehner’s picture

Status: Patch (to be ported) » Fixed

and fixed

Status: Fixed » Closed (fixed)

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