9

Image

I've just made a Views for a content type.

In one views, I need a page for the content type and a preview of 4 newest posts on the front page.

Page is not the problem. For front page preview, I just confused about the purpose of "Attachment", "Content pane" & "Context". I don't know which one to use for front page preview.

"Context" does not have more link, and "Content pane" is not for Panels pane since Panels module is disabled.

10

The Attachment option is to create yet another view that you can attach before and/or after any of the displays on your current view.

An example of its use is if you enable the taxonomy views the taxonomy pages are overwritten by the view and if you were to add a couple of extra fields like images, description, etc to your taxonomy term you can the use an attachment to display it as the header of each taxonomy page.

The EVA module extend this functionality by allowing you to attach views to content types and other entities.

The other two I have never use, but:

Here is an explanation about "Content pane":

http://drupalize.me/videos/basics-views-content-panes

| improve this answer | |
3

Content pane is usually used inside a panel (Panels module). You can think of it as a block, but usable inside Panels, than can get arguments, etc from the panel.

| improve this answer | |
0

For drupal 8, when using a pager and you want the attachment to show only on the first page:

Create a new template for your view (views-view-unformatted.html.twig) and add this code:

{% if view.pager.current_page == 0 %}
    {% if attachment_before %}
    <div class="attachment attachment-before">
      {{ attachment_before }}
    </div>
  {% endif %}
{% endif %}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.