I have 2 related content types (Order and Proposals). In the Order Detail page, I attach the proposals for that order using EVA with table format.
I want to add an action button (vote) in EVA output (orange colored box buttons), so that when it's clicked, it updates the Vote field in the corresponding proposal node. I don't know where to start.
I've tried using hook_view_pre_render()
but I can't find the corresponding object because the dpm()
breaks the site.
This is the code I am using.
function mymodule_views_pre_render(\Drupal\views\ViewExecutable $view) {
if ($view->id() == 'order_proposal_list') {
$results = $view->result;
dpm($view); // This breaks the site.
ddm($view); // This outputs 300000 and more lines in drupal_debug.txt.
}
}
Somehow, I can get that field value using this code, but it's still not enough.
function mymodule_preprocess_views_view_field(&$variables) {
$view = $variables['view'];
if ($view->id() == 'order_quotation_list') {
if ($variables['field']->field == 'edit_node') {
dpm($variables['output']);
}
}
}