Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / entity_reference_revisions / src / Plugin / views / row / EntityReferenceRevisions.php
1 <?php
2
3 namespace Drupal\entity_reference_revisions\Plugin\views\row;
4
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\views\Plugin\views\row\Fields;
7
8 /**
9  * EntityReferenceRevisions row plugin.
10  *
11  * @ingroup views_row_plugins
12  *
13  * @ViewsRow(
14  *   id = "entity_reference_revisions",
15  *   title = @Translation("Entity Reference inline fields"),
16  *   help = @Translation("Displays the fields with an optional template."),
17  *   theme = "views_view_fields",
18  *   register_theme = FALSE,
19  *   display_types = {"entity_reference"}
20  * )
21  */
22 class EntityReferenceRevisions extends Fields {
23
24   /**
25    * Overrides \Drupal\views\Plugin\views\row\Fields::defineOptions().
26    */
27   protected function defineOptions() {
28     $options = parent::defineOptions();
29     $options['separator'] = array('default' => '-');
30
31     return $options;
32   }
33
34   /**
35    * Overrides \Drupal\views\Plugin\views\row\Fields::buildOptionsForm().
36    */
37   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
38     parent::buildOptionsForm($form, $form_state);
39
40     // Expand the description of the 'Inline field' checkboxes.
41     $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." );
42   }
43
44   /**
45    * {@inheritdoc}
46    */
47   public function preRender($row) {
48     // Force all fields to be inline by default.
49     if (empty($this->options['inline'])) {
50       $fields = $this->view->getHandlers('field', $this->displayHandler->display['id']);
51       $names = array_keys($fields);
52       $this->options['inline'] = array_combine($names, $names);
53     }
54
55     return parent::preRender($row);
56   }
57 }