0
votes

I add multiple fields with

 $view->addHandler($view->current_display, 'field', 'views', 'nothing', array(
  'label' => 'My field',
  'type'  => 'textfield',
  'alter' => array('text' => 'My field text'),
  'element_class' => 'my-field',
  'element_default_classes' => 0,
  'group_rows' => TRUE
), 'my_field');

this works fine but i can't find a way to alter it, because the result data in pre_render, post_render, post_execute doesn't include these field only has entity fields which can be changed with

$result->_entity->set('title', 'newtitle')

i managed to change the field values eventually with template_preprocess_views_view_field() but that doesn't work for data export .csv / .xls

created a new views field in hook_views_data and a new plugin extending FieldPluginBase but that that doesn't work with addHandler.

is there a way to add dynamic fields and modify the output or create a new viewsfield and use it with $view->addHandler ?

1
have to create a new views field plugin and use that instead of nothing, and in the render function the value can be customized - Kiss József

1 Answers

0
votes

have to create a new views field plugin and use that instead of nothing, and in the render function the value can be customized