Add destination to drupal view field link - drupal

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.

Related

How to add view to node (drupal 8)

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

Add a new section to the wp-admin edit post page

One of my post types is called Events and on here I have typical things like a post title, body, event date, etc.
In the site's code (on a custom template), I am programmatically adding meta to events when a user signs up (custom array of values).
The problem is that an admin can't see this data.
I wanted to know how I could add a custom section or template so when an admin inside wp-admin goes to any given event, and edits this single post/event, they can see the metadata associated.
I want to just add a new field section somewhere, called "Registrations", and then I'd programmatically access the meta and format it how I want, put some HTML/CSS in there, etc.
If anyone could point me in the right direction I would appreciate it.
Thanks!

Drupal View, get node id to use a template

How can I get node id for the Drupal View I just created?
The view has a Page path, and I can see the View.
However, in order to exclude the sidebars from it I had to create a Basic Page and then a template page--node--nodeid.tpl.php to override it. Then, in there, I rendered the view.
But since the View already is a page (I guess) and all content is a node, it should have a node id. That way I wouldn't need to create a Basic Page.
I've tried looking at Theme Information but those templates overrides are for the view, not for the entire page.
Thanks.
Not all content is a node. Your Page View is likely displaying fields from certain other nodes, however.
If your goal is to hide those sidebars on that particular page, you could go into page.tpl.php and do something like:
<?php
$path = drupal_get_path_alias(current_path());
if($path != "/my/view/path"){
print render($content['my_sidebar_region']);
}

Drupal direct link add node in node

I've got a drupal website, with Page and Paragraphs. I need a solution to add a Paragraph directly in a Page with a link. My paragraphs are linked to the page by node reference module.
Something like: mywebsite.com/node/add/paragraph?nid-page=21
With this link i will be able to add a new paragraph, and the corresponding page will automatically be updated with this new paragraph.
I hope i was clear enough.
Thank you :)
You are on the right track.
I would register a new callback (similar to the above) which retrieves the paragraph node form, adds a new submit callback too the form which does :
Add node reference
Add form redirect to the page node page.
Then render this form.
Or, you can use URL params like you have above and do a form alter on the paragraph node form when that URL param is present. The form alter would do the same as the above.
If you need a code example let me know and I can whip something up in a bit.

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)

Resources