0

I have a view (block) created. When I modify the view block, I have only the field "block title" in the form. However they are 3 fields (block title, block description et block body) in a block of drupal (which I can create via /structure/block/add).

So my question is how can I add a custom field (like a textfield) to the form of views block? Is it possible to add it programmatically?

Thanks in advance.

6
  • why do you want to add the field?
    – 2pha
    Commented Jan 28, 2015 at 13:08
  • What's your purpose of doing it?
    – Ehsan
    Commented Jan 28, 2015 at 13:21
  • Views are only for viewing data (aka reporting data). So, if your aim is to make a view as an add/edit node form, it is not practically possible!
    – Ehsan
    Commented Jan 28, 2015 at 13:22
  • However it's possible to connect views to forms for showing some queried data.
    – Ehsan
    Commented Jan 28, 2015 at 13:23
  • @2pha @Ehsan because I want also a body field for my view block, without having to edit the view. If I have the body field for my view block, I just need to go to admin/structure/block/manage/views/[view_id]/configure, like the other blocks created by module block.
    – stevey
    Commented Jan 28, 2015 at 13:26

1 Answer 1

0

Views is used to pull in existing data/content from other nodes so that you can customise and display it either in new a page or block. There is no body field on the blocks page for a views block is because the contents of that block is controlled by the view and can change dynamically. So if you want to change the body text displayed in the view you can edit the body field of one of the content nodes your view is collecting from.

When I want to add extra custom text to a view I usually add a random field to the view and then inside that fields settings enable rewriting to allow rewrite the fields output with custom values, if you want to go a bit deeper you can use the module Views Custom Fields as another alternative: https://www.drupal.org/project/views_customfield, but as far as I know editing the body of a views block directly from the blocks admin page is not possible without writing some custom programming.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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