Answers.Body: <p>It looks like we used to do this via the php filter module but stopped doing so for security reasons and have added this snippet of code to a module to provide the contextual filter to the view:</p>
  
  <pre><code>function tidbits_views_pre_build(&amp;$view) {
    if ($view-&gt;name == 'your_view'
      &amp;&amp; ($view-&gt;current_display == 'block_1' || $view-&gt;current_display == 'block_2')) {
      $view-&gt;args[] = $_GET['cid'];
    }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-19T20:46:25.607Z
Answers.Text: NB: I am just the messenger, not the developer, I hope the above makes enough sense without more context
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-22T07:43:11.277Z
Answers.Text: let us know how you got on with it when you know
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-22T18:45:19.053Z
Answers.Text: Pete, with Coleman's confirmation of how it has worked in the past, I've marked the cid= solution as the answer because it solved this particular issue, but if we have a form that needs multiple contact IDs along with a View, I think your solution (which did make sense) will work.  Thank you again. I love this community!
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-22T22:39:35.760Z
Answers.Text: ah ha - good to know - might be useful to us sometime time - agree with the community ;-)
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-19T20:45:25.350Z
Answers.LastActivityDate: 2015-12-19T20:45:25.350Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>After much trial and error, we discovered that the webform and Views block both populate correctly with a supplied link of <code>/family-info?cid=[id]</code>.  By removing the <code>1</code> between <code>cid</code> and <code>=</code>, the View contextual filter works properly and the webform still auto-fills.  I don't know the implications if one were to try to have multiple contact id's, but for our purposes of only one contact id, this resolves the issue.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-19T20:23:03.803Z
Answers.Text: hmm interesting. i think we used some php to do this but can't find it quickly so can't share sorry
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-22T17:13:14.947Z
Answers.Text: Yes, when webform_civicrm started supporting multiple contacts the `cid` url arg was deprecated in favor of `cid1` but there no plans to remove support for it as it's useful to have in situations like this.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-22T18:46:39.940Z
Answers.Text: Thank you @Coleman, that confirms that this can work as a solution and not just a hack we stumbled upon. :-)
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-23T22:38:43.997Z
Answers.Text: No prob. Of course if the two modules didn't happen to both support the same argument name (e.g. with multiple contacts) you could always do `/family-info?cid=[id]&cid2=[id]` to supply it in both forms.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-19T19:19:11.307Z
Answers.LastActivityDate: 2015-12-19T19:19:11.307Z
Answers.UserDisplayName: Allen Hutchison
Body: <p>As an alternative to "<a href="https://civicrm.stackexchange.com/questions/7272/how-can-i-display-an-info-only-field-in-a-webform">How can I display an info only field in a webform</a>", we are displaying a read-only View block on a CiviCRM-enabled webform page via <a href="https://www.drupal.org/project/context" rel="nofollow noreferrer">Context</a> because one of the fields of the View block is an embedded View (via the <a href="https://www.drupal.org/project/views_field_view" rel="nofollow noreferrer">Views Field View</a> module).</p>
  
  <p>We are linking to the webform from another view so that we can supply a Contact ID in the URL, allowing the webform to auto-fill with a contact's information.  Per the <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Webform+CiviCRM+Integration" rel="nofollow noreferrer">instructions for Generating URL arguments from Views</a>, our link is as follows: <code>/family-info?cid1=[id]</code>.</p>
  
  <p>The link correctly supplies the contact ID to auto-fill the webform fields, but does not return any results for the View block that is on the page.  I confirmed that the View block is setup correctly because I can supply a contact ID in the View preview in the Views UI and the block information displays correctly.  <strong>There seems to be a difference between how the webform is reading the URL argument and how the Views block is reading it.  Any ideas on how to make the two work together?</strong></p>
  
  <p>Drupal 7.41; Webform 4.12; CiviCRM 4.6.6; CiviCRM-Webform Integration 4.14</p>
  
Tags: <webform-civicrm><drupal-views>
Title: Displaying a Views block with a CiviCRM-enabled webform
ThreadText: # Displaying a Views block with a CiviCRM-enabled webform
  
  (Asked by: username_0 on 2015-12-19)
  
  As an alternative to "[How can I display an info only field in a webform](https://civicrm.stackexchange.com/questions/7272/how-can-i-display-an-info-only-field-in-a-webform)", we are displaying a read-only View block on a CiviCRM-enabled webform page via [Context](https://www.drupal.org/project/context) because one of the fields of the View block is an embedded View (via the [Views Field View](https://www.drupal.org/project/views_field_view) module).
  
  We are linking to the webform from another view so that we can supply a Contact ID in the URL, allowing the webform to auto-fill with a contact's information. Per the [instructions for Generating URL arguments from Views](http://wiki.civicrm.org/confluence/display/CRMDOC/Webform+CiviCRM+Integration), our link is as follows: `/family-info?cid1=[id]`.
  
  The link correctly supplies the contact ID to auto-fill the webform fields, but does not return any results for the View block that is on the page. I confirmed that the View block is setup correctly because I can supply a contact ID in the View preview in the Views UI and the block information displays correctly. **There seems to be a difference between how the webform is reading the URL argument and how the Views block is reading it. Any ideas on how to make the two work together?**
  
  Drupal 7.41; Webform 4.12; CiviCRM 4.6.6; CiviCRM-Webform Integration 4.14
  
  **Tags:** webform-civicrm, drupal-views
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2015-12-19. Score: 3 | Accepted answer
  
  After much trial and error, we discovered that the webform and Views block both populate correctly with a supplied link of `/family-info?cid=[id]`. By removing the `1` between `cid` and `=`, the View contextual filter works properly and the webform still auto-fills. I don't know the implications if one were to try to have multiple contact id's, but for our purposes of only one contact id, this resolves the issue.
  
  > **Comments:**
  > **username_1**: hmm interesting. i think we used some php to do this but can't find it quickly so can't share sorry  
  > **username_2**: Yes, when webform_civicrm started supporting multiple contacts the `cid` url arg was deprecated in favor of `cid1` but there no plans to remove support for it as it's useful to have in situations like this.  
  > **username_0**: Thank you @username_2, that confirms that this can work as a solution and not just a hack we stumbled upon. :-)  
  > **username_2**: No prob. Of course if the two modules didn't happen to both support the same argument name (e.g. with multiple contacts) you could always do `/family-info?cid=[id]&cid2=[id]` to supply it in both forms.  
  
  ---
  
  ### Answer by username_1 on 2015-12-19. Score: 2
  
  It looks like we used to do this via the php filter module but stopped doing so for security reasons and have added this snippet of code to a module to provide the contextual filter to the view:
  
  ```
  function tidbits_views_pre_build(&$view) {
    if ($view->name == 'your_view'
      && ($view->current_display == 'block_1' || $view->current_display == 'block_2')) {
      $view->args[] = $_GET['cid'];
    }
  }
  
  ```
  
  > **Comments:**
  > **username_1**: NB: I am just the messenger, not the developer, I hope the above makes enough sense without more context  
  > **username_1**: let us know how you got on with it when you know  
  > **username_0**: Pete, with username_2's confirmation of how it has worked in the past, I've marked the cid= solution as the answer because it solved this particular issue, but if we have a form that needs multiple contact IDs along with a View, I think your solution (which did make sense) will work.  Thank you again. I love this community!  
  > **username_1**: ah ha - good to know - might be useful to us sometime time - agree with the community ;-)  
  
  ---
  
  