diff --git a/README.txt b/README.txt index 3eb14fb..ee31158 100644 --- a/README.txt +++ b/README.txt @@ -1,21 +1,28 @@ This module allows you to embed a View as a field in another View. -The View in the view-field can accept argument values from other fields of the parent View, using tokens. +The View in the view-field can accept argument values from other fields of the +parent View, using tokens. Here's how: -1. Before you can add a view-field to a "parent" view, you must create a "child" view. -2. Add arguments to that child view. The parent view will be passing argument values to - the child so that the child knows what to display. No other settings are necessary, - but validators and "argument not present" could be set. +1. Before you can add a view-field to a "parent" view, + you must create a "child" view. +2. Add arguments to that child view. The parent view will be passing argument + values to the child so that the child knows what to display. No other + settings are necessary, but validators and "argument not present" could + before set. 3. Create a "parent" view, if not already existing. -4. Add child view (Global:View field). The field must be toward the bottom of the field list, - or at least underneath the fields that are going to be used as arguments. - (E.g., "node id" might be used as an match between the parent and child views, - so put the "node id" field before your Global:View field in the list.) -5. Select which View and Display to use for the child data (will require doing this in 2 steps - - the field must be saved before the display selection is available). -6. Find which tokens are available by looking at the "Replacement patterns" list right below the Arguments setting. - Type the token replacements, in order, separated by a comma, as the arguments for that view field. - These values will be passed to the child. Make sure each field you are passing as an argument is completely clean, - as in: no label, no formatting, nothing that would pass into the argument other than the desired text or number. +4. Add child view (Global:View field). The field must be toward the bottom of + the field list, or at least underneath the fields that are going to be used + as arguments. (E.g., "node id" might be used as an match between the parent + and child views, so put the "node id" field before your + Global:View field in the list.) +5. Select which View and Display to use for the child data (will require doing + this in 2 steps - the field must be saved before the display selection is + available). +6. Find which tokens are available by looking at the "Replacement patterns" + list right below the Arguments setting. Type the token replacements, + in order, separated by a comma, as the arguments for that view field. These + values will be passed to the child. Make sure each field you are passing + as an argument is completely clean, as in: no label, no formatting, nothing + that would pass into the argument other than the desired text or number. diff --git a/css/views_field_view.css b/css/views_field_view.css index 87c2da7..2c8335c 100644 --- a/css/views_field_view.css +++ b/css/views_field_view.css @@ -1,6 +1,6 @@ #edit-options-view-edit { margin: 15px 0px; - background-color: #F3F4EE; + background-color: #f3f4ee; padding: 5px; } diff --git a/src/Plugin/views/field/View.php b/src/Plugin/views/field/View.php index 2115af0..193b32b 100644 --- a/src/Plugin/views/field/View.php +++ b/src/Plugin/views/field/View.php @@ -13,6 +13,8 @@ use Drupal\views\Views; use Symfony\Component\DependencyInjection\ContainerInterface; /** + * View object class. + * * @ViewsField("view") */ class View extends FieldPluginBase { @@ -63,7 +65,7 @@ class View extends FieldPluginBase { /** * {@inheritdoc} * - * Only allow the field to be there, no other aggregation make sense + * Only allow the field to be there, no other aggregation make sense. */ public function buildGroupByForm(&$form, FormStateInterface $form_state) { parent::buildGroupByForm($form, $form_state); @@ -151,8 +153,12 @@ class View extends FieldPluginBase { // Provide a way to directly access the views edit link of the child view. // Don't show this link if the current view is the selected child view. if (!empty($this->options['view']) && !empty($this->options['display']) && ($this->view->storage->id() != $this->options['view'])) { - // use t() here, and set HTML on #link options. - $link_text = $this->t('Edit "%view (@display)" view', ['%view' => $view_options[$this->options['view']], '@display' => $this->options['display']]); + // Use t() here, and set HTML on #link options. + $link_text = $this->t('Edit "%view (@display)" view', + [ + '%view' => $view_options[$this->options['view']], + '@display' => $this->options['display'], + ]); $form['view_edit'] = [ '#type' => 'container', '#fieldset' => 'views_field_view', @@ -177,7 +183,7 @@ class View extends FieldPluginBase { '#suffix' => ']', ]; $form['view_edit']['description'] = [ - '#markup' => $this->t('Use this link to open the current child view\'s edit page in a new window.'), + '#markup' => $this->t("Use this link to open the current child view's edit page in a new window."), '#prefix' => '