Is there any hook available so that i can add some columns or buttons in the content section of drupal - drupal

Here i want to add a my own custom column in the content section through my own custom module which should automatically appear on the content section when module is installed , so in order to do that i looked for hooks available but could not find one. So can anyone suggest me some way in order to achieve this.Content Section with the requirement
Here in the above image i want to add a custom column.

This is admin view,
You can achieve this by following:
Go to "/admin/structure/views/view/content" and add column manually
by using hook_views_pre_render and target view with machine name as "content".

Related

Change of module title

A customer of ours is using 2sxc and whenever they edit an item, the moduletitle is overwritten with the title from the content they just edited.
How can I prevent this from happening. They want to use the ´static´module title.
You will have to choose a skin container for the module that has no title. then insert a new html module above the 2sxc content/app to create your title. Otherwise the title is built into the template of the content in 2sxc which you should be able to easily modify to be a static string instead of a dynamic title.
The auto-update title cannot be modified. if it's really important you could suggest it as a sponsored feature.
You could also try to give the content two titles - one to show in the module, the other for whatever you need the non-module title.

Custom spaces editable from back office in Drupal

I've got a website in Drupal where in some parts of the site I need some editable spaces to put some banners and edit them from backoffice, (something similar to placeholders in Django).
Is there any module or a way to do this?
Thank you!
There is the block module, which is part of core. Are you using Drupal 6/7/8?
Anyway go into your admin section and look under structure, for blocks.
You can create custom blocks and place them in a region. If you want different regions then you can define these in your themes .info file.
Inside the blocks you can put whatever content you like.
Than you for your help , this did the job:
< ? php
 $block = module_invoke('block', 'block', 'view', "23(block number)"); 
 print $block['content']; 
? >
So, to create a custom (static) block you should go to "Blocks" admin page (Structure -> Blocks) and click "add block page" link. When creating the block pay attention on input format field (bellow "block body" field). If you use some format with filters drupal can (partially) destroy your block code - filter out some content. So, if you are sure that code you are using is safe and don't want it to be changed by drupal select "raw" format.
Every theme has defined regions that it supports. They are defined in:
/sites/all/themes/theme-name/theme-name.info file
So, if you want to change page template and print blocks on your own you must use some existing regions, defined there (it's needed to clear the cache after changing this file).
Region names can also be seen in Blocks admin page mentioned above. On that page you'll see the list of all available blocks and next to block name you'll see drop-down for placing block into some region.
Also, if you edit some block (click "configure" link next to that drop-down) you'll have some extra options to set block visibility (per user, per user role, per page..).
For more advanced block placement use "Context" module which have more powerful features for placing blocks and more:
https://www.drupal.org/project/context

Drupal 7: Add view to content type

I've been making a template for a particular content type, but just ran into a problem: I need to embed a view into the content type.
I am aware this can be done via several different methods, but I don't see one that fits exactly my needs:
I need the view added automatically for all pages of that content type.
Using blocks in a region is not an option, as I want to avoid defining a region in the middle of a page that should only be available for a specific content type.
Translatable label.
Possibility to freely apply a template to all fields in the content type (excluding the embedded view).
I tried doing it via page layout (Panels) and simply adding node content fields and the view to my layout regions, but then I get another problem: I can't style my content fields without doing something that seems a bit over the top:
Currently I have about 20 different content fields in the content type that are wrapped in HTML and styled in my template file. I have a translated label for each of these in the template file. From what I can tell I'd have to add a template for each of the panes containing content fields to add my translated labels and HTML needed to style each field.
I'm not really fond of making 20 templates, 20 theme hook suggestions to get the templates to work and 20 regions in the panel layout just to get a view inserted in the content type.
Am I doing something terribly wrong here? Any suggestions?
You may want to try the Viewfield module or similar modules (search for "view field" or "view reference").
If you are doing something more complex like changing/filtering the view based on some value in your content type, then you may have to use Viewfield module in combination with something else that will help fill in the filter values.
I've never done something like this before so I'm not sure exactly what module combination would work but Rules or Computed Field come to mind as possible helpers.
You have to use "views node field" http://drupal.org/project/viewsnodefield, after installing this module you have to select the "Node content" in the display (like blocks,page). then click the add display. if you want to display the content like this page http://www.richtown.ae/?q=content/arabian-ranches then you have to download the views_galleriffic module and install it and choose the style option "Galleriffic Gallery". You can choose the content type by using the filter in the views.
That's it cheers
i implemented this in my website richtown.ae
if you still unclear please send me the email social#richtown.ae i will reply you & ready to help you we can share information
i am using this module in drupal 6.
I resorted to using the EVA module ( http://drupal.org/project/eva ).
In addition to Woodgnome's answer
Let's say you have a content type named 'Product'
You want to attach a view to it.
Here are the steps using the eva module :
On your view edit page :
Section Displays
+Add : Eva field
Section ENTITY CONTENT SETTINGS
Entity type:Node
Bundles:Product
That's it, going to a node product type will now display the view

Is it possible to add buttons (link) to a view in Drupal?

I am looking to add separate buttons that will be displayed at the top of the view that I am creating in Drupal.
So far all the fields that I have added appear inside of the table as they should. The only thing that shows outside of the table is the search filter above (as it should).
I would like to add 3 buttons(links) in a row that are positioned above the table and below the search area.
Is there any way to do this in Views? If so could someone describe the process? Thanks!
The most straightforward way to do this is through the theme layer. Edit the view, and go into the Header option under Basic settings. There, you can put in your custom HTML for the buttons.
However, as you might've noticed, this places the header above the exposed filters, whereas you want the header below them. To do this, go into the Theme information option under Basic settings, and find the Display output section.
There, you'll see a list of file name hints. Create a file within your theme using one of those filename hints. Then, click on Display output: you'll receive the default code you'll need to put within your newly created template file.
You'll notice in this new template of yours that the $header code block is before the $exposed code block. Just switch the positions and save your template. Back on the view configuration page, click on Rescan template files, save your view, and the header you've added will now be below the exposed filters.

How do I add items in Primary Links automatically as soon as some user publish new content

I am building a website www.etutornetwork.com, in top menu I have included a link to a new content type [services]. I want to add a link in dropdown menu as soon as I publish new content in services.
Please Help, Thanks in advance.
and one more question, I dont want to give any name to one of the menu in the site. I tried using or leaving it blank, but it does'nt like this.
You can attach it in node creation time (see Menu fieldset), or use module like Auto Menu. Some more details about this module (from its project page):
The Auto Menu module automatically generates menu entries on node creation/edition. Parent menu item can be specified on a per content type basis.
This module acts when the menu section of a node is left empty only. So, users can still organize menus manually. Moreover, default setting for content types is to not create menu items automatically.
I use Taxonomy Menu, to create my secondary menu. It is very flexible to use. Some more details about this module (from its project page):
Features
Custom Menu per vocabulary
Uses the default taxonomy term path or custom paths
Integrate with Views
Integrate with Pathauto: use URL/path aliases
Does not interfere with other menu modules
You can take away the permission from users dealing with menus. Then when you are publishing submitted content from them, you can assign them a menu entry and control the title.
Other than that, you could use Views (since Services is a content type) to create a block that lists all Services with links directly to the node.
Either way, someone will have to title the nodes/menu items. It's easier administrative wise to remove menu permissions from users submitting content.

Resources