1

I created a content type call Block. I want to use Views to display this Block content type per node. It means when I create a Block node, Views will create a block for me. So far I don't see any setting in Views allow me to do this. If it is possible I prefer using Views to do it instead of install another module like Nodeblock(nothing against it, just don't want to install another module when existing one can do it).

My original question is a bit confusing. To clear it up:

  1. Is it possible for user to create a block by using a node? For example, user create a new node call 'My day' will automatically create a new block call 'My day'.
  2. Is it possible to accomplish it by using Views module?
2
  • what I understand is you want to make each content a view. so why don't you use a just another display format from display management tab? It so far better than coupeing with views module for simple thing
    – shekoufeh
    May 14 '15 at 3:49
  • Welcome to Drupal Answers! Stack Exchange sites are Q&A sites: There is a question, and answers. Answers are not mixed up with the question, but kept separated. Also, we don't make a summary of what said in the answers in the question itself.
    – apaderno
    May 14 '15 at 7:52
1

In your edit view, click on Advanced (located on the right side) For Contextual Filters click add. Search for "nid" and select Content: Nid

Under When Filter Value is not available, select the 2nd one (provide default value). For Type, select Content ID from URL.

This will filter your view, and show you the fields only from the current "Block content type" node that you're viewing.

5
  • Thank you very much for quick reply. I tried above suggestion and it doesn't work. I think I wasn't clear for the question. I mean one Block node for one block. If I have three Block nodes, Views will create three separated blocks for me. Is it possible or I just didn't do it right with your suggestion. Thanks again!
    – wzh
    May 14 '15 at 2:48
  • Under Displays, you could use the add button and keep adding view blocks which would be the equivalent of having separate views. You would have to do this manually, there is no way to automate this though.
    – No Sssweat
    May 14 '15 at 3:29
  • just curious, why do you want separate blocks? What exactly are you trying to do?
    – No Sssweat
    May 14 '15 at 3:34
  • I want client to create a block by using content type instead of go to Block area to do so. I think it is easier for new user to operate. Since Views module already there I thought it can accomplish that. I guess I have to find other ways, still thanks a lot!
    – wzh
    May 14 '15 at 3:57
  • What you're looking for is Bean. It lets you create content types for blocks, essentially. Users edit blocks in the same way as they do with content types. Take a look, it'll do exactly what you are describing. While I understand you point about not installing a module, there are occasions (such as this) when certain modules do a better job of hacking other modules not really suited to a particular task.
    – user1731
    May 14 '15 at 4:04
1

I don't know of any way to achieve what you're trying to do by only using the Views module. However, whenever you're ready to consider adding another module (such as the nodeblock you mentioned), I would start by looking at the Bean module (instead of nodeblock). Here is a quote about its project page:

Think of a Bean as a method to provide new types (compared to node this would be a content type) which then provides an add content interface to create as many blocks as you require (see screenshot below). The bean content can then be placed around the site just like any other block.

Combined with the options available for granting the appropriate Bean permissions, it should give you a lot of flexibility about how exactly you want to use this (great) module in your specific case. As a bonus, the Bean module also works great in combination with the UUID and UUID Features Integration modules. On top of that, after you become familiar with the Bean module, you might find other cases in your site where you also want to use the Bean module (which somehow compensates the fact that you need to add another module).

Note: your question contains "Block node" and "block", which I find a bit hard to differentiate to correctly understand your question. Therefor consider editing your question by replacing "Block node" by something like "MyBlocktype node" (or anything different from just "Block").

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.