- Issue created by @g.rocchini
I can't read the value of a custom field added to the View
Create a @ViewsField in a custom module. In my case is a simple checkbox like with the following code
public function render(ResultRow $values) {
return [
'#type' => 'checkbox',
'#title' => $this->t('Select'),
'#default_value' => FALSE,
'#attributes' => [
'id' => 'custom_checkbox_' . $values->_entity->id(),
'name' => 'custom_checkbox[]',
'value' => $values->_entity->id(),
'class' => ['custom-checkbox-class'],
],
];
}
Then try to read the submitted value from a custom ViewsBulkOperationsActionBase action.
I've tried the following method
// Debug of the view
$view = $this->view;
\Drupal::logger('tester')->debug("getExposedInput <pre>".print_r($view->getExposedInput(), 1)."</pre>");
\Drupal::logger('tester')->debug("getResponse <pre>".print_r($view->getResponse(), 1)."</pre>");
\Drupal::logger('tester')->debug("getRequest <pre>".print_r($view->getRequest(), 1)."</pre>");
\Drupal::logger('tester')->debug("view <pre>".print_r($view->result, 1)."</pre>");
// Debug of the entity
\Drupal::logger('tester')->debug("entity <pre>".print_r($entity, 1)."</pre>");
// Debug of the context
$cont = $this->context;
\Drupal::logger('tester')->debug("context <pre>".print_r($cont, 1)."</pre>");
No one work.
Can someone help me?
Thanks
Active
4.3
Integration