How to add view to node (drupal 8) - drupal

I have create view with custom type "banner".
And I have node with custom type "product".
The product node have page. /product-1
How to link the banner view to product node?

Login as admin account to Drupal
got to the page
/admin/structure/block
Find your view at bottom (if you create view block)
Click on Configure
See the section Visibility
Select tab Pages
Show for the listed pages option is already selected you can change this as per your needs
Now put your URL into the textarea like
if you want your view should display only on a single page put your full URL in this textarea like
product-1
but if you want your block should display on all page which has URL like product-1, product-2, product-3 and so on you can put your URL with wildcard entry like
product-*
Now your views block should display on all pages starting URL with product- not matter what is after product- your views block will display on all pages
I hope you get some points of action to achieve you needs
Thanks

Related

Drupal: display views page instead of default node/%

Case is that im using views for displaying each of content-types.
eg. q=?news/12 for news by nid
q=?product/13 for products by nid
Problem is when im creating (or editing) new content, it automatically displays (or refer) ?node/14 instead of ?product/14. Also menu link is created under node/14 link.
How could i set each view to referring content type?
Thanks in advance.
You can create a view (display mode : page) for each content type, which displays datas from your node (fields or whatever you need). To do so, add a contextual filter in your view, on content nid, give default value : content nid from url. Then give to this view a url like "/news/%". So "/news/12" hits this view and grabs data from news content type with id 12. Then you can manually modify menu link, or use pathauto to specify /news/[node:nid] as a pattern for all your news nodes (I never tried all this stuff together but it should work).
Other solution : https://www.drupal.org/project/contemplate (seems deprecated...)
Other solution : create a .tpl for your content type nodes : node--news.tpl.php, but no more views...
Other solution : create a view displaying one particular node data (like I explain first with a contextual filter), this view creates a block (display mode : block), you assign this block to a region (with block interface), and set this block to be displayed only for the news content type (last menu on the left on the block configuration page). Then with Display Suite you hide everything for this content type on the full content display. So on each node page which refers to a "news" node, you have nothing in your page but your block (and the node title, which you can remove with display suite extras I guess).
Good luck with it

Including View blocks into a view page?

How can I include view blocks into a view page? Let's say I have two view blocks named "promoted_feed" and "sliding_feed" and I want those included in /frontpage view?
From UI: Each views block created are listed under admin->structure->blocks by the block name you assigned it to, when you created the view. To make the views block be rendered into a page (any valid drupal url), go to structure->blocks, find the block, click configure. On the configuration page, scroll all the way down to Visibility settings -> pages -> only the listed pages, list the path(relative, no leading '/') for view page and save.
May be views_field_view is what you need?

How to assign view block to dynamic taxonomy term page for CCK entries

http://localhost/rkk/work-type/non-profit
I created a vocabulary and terms under for work-type. and I created some posts...
Then I created a View Block to list my entries, and assigned to a page... everything fine so far.
I display the work-type at entry details page. and I have a link "click to see other non-profit(assigned work type) works". When I click this link, it lists entries assigned to that particular work-type. thats fine, but it displays title/body/readmorelink :/ I need custom view for this page, like I did View Block for listing all posts...
Can I assign custom created View Block to this taxonomy entry list page? the url changes according to work-type, so how do I assign view to changing-url :/
Appreciate helps!! thanks a lot!
UPDATE FOR MORE INFO:
I have a vocabulary (work type), and terms under (corporate, non-profit, etc...)
I have a CCK for "work", and as a field I have select terms of work-type vocabulary.
I have a Custom Views Block to display works in a page (thumb, title, desc, link, etc.).
When I click a work, it goes to particular Work entry details page, I place a link in there "click to see other -term (corporate)- works", etc.
When I click this link, it displays the Work Entries under that particular term. it works fine. but it displays as default look (shown as below), but I need this page same as main works page list (thumb, title, desc, link, etc.) I already have a View for this, but how can assign this View to this dynamic url taxonomy page? I found the module http://drupal.org/project/tvi , but cant make it work.
It should be simpler to overwrite term pages with a view, there's already a pre-configured view for this : taxonomy_term (wich is disabled by default)

Add destination to drupal view field link

How can I add a desintation to a custom edit link in a view field?
I have a field in my view where I've customized the field to render as a link. How do I add the current view's page to the link as a destination, so that when the person follows the link and fills in the form, they will be redirected back the same view page they were on? Needs to include the page number variable as well.
G
You can override the theme for a particular field and use PHP to render the link however you like. Get the view arguments from $_GET['q'] if you'd like to manipulate them.
Alternatively,
drupal_get_destination(); will give you the current page as "destination=myView/with/args" to append to the link.

Drupal: can I place a views filter (Search items) in a website block?

I'm using Drupal and in the "Filters" list there is also the "Search Term" filter which works great.
I use it to search a specific node in my Views list.
However such field only displays when I'm in the view page, but I would like to display on any page of my website (let's say as a block) (and when I search for something, the view page is loaded with the filtered nodes.
Do you know how could I make it ?
thanks
In your view configuration page there should be a field: Exposed form in block. If this is checked then views will create a block with the filters on it rather than embedding it in the view itself. This block can be placed from the block configuration screen and you can make it show on any pages that you want.
I think the option lived under the Filter section in Views 2, in Views 3 it's in its own place called Exposed Form.

Resources