EntityReferenceRevisions.php in Entity Reference Revisions 8
File
src/Plugin/views/row/EntityReferenceRevisions.php
View source
<?php
namespace Drupal\entity_reference_revisions\Plugin\views\row;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\row\Fields;
class EntityReferenceRevisions extends Fields {
protected function defineOptions() {
$options = parent::defineOptions();
$options['separator'] = array(
'default' => '-',
);
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['inline']['#description'] .= '<br />' . $this
->t("<strong>Note:</strong> In 'Entity Reference' displays, all fields will be displayed inline unless an explicit selection of inline fields is made here.");
}
public function preRender($row) {
if (empty($this->options['inline'])) {
$fields = $this->view
->getHandlers('field', $this->displayHandler->display['id']);
$names = array_keys($fields);
$this->options['inline'] = array_combine($names, $names);
}
return parent::preRender($row);
}
}