Drupal direct link add node in node - drupal

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.

Related

ShareThis button directly in Drupal's tpl.php files

I only need to show custom button for sharing on nodes, but I need to put a different button on a lot of places (block quote, view result, image in node...) and to share just that part (probably with anchor tag suffix in the url). When the user clicks on the button, the modal/popup of ShareThis should be shown.
Is there any way to implement this directly into tpl.php file?
There is an example of the similar implementation of AddThis, something like this I need from ShareThis:
<div class="addthis_sharing_toolbox" data-url="THE URL" data-title="THE TITLE"></div>
It is not necessary for me to use the module, so any idea or possible aproach to this is welcome.
Looking at the following link: http://support.sharethis.com/customer/portal/articles/464452-integration-with-a-website you could add the javascript to the html.tpl.php file and the class in the node.tpl.php file or a custom block.
You can add any kind of code to template files of course. If it's just for specific content type add it to node template. And if it should be added for all (or many) content types (outer template) add it to page.tpl.php...or most outer if you want to place some content to i.e. page header - html.tpl.php
There you can put some if statement to i.e. display it on every node page except some...

plone: "to the top of the page"-link at the end of a collection list

how can I add a "to the top" link at the end of a collection in plone?
This collection is in a collage. I thought of adding the article type "page" in a new row where I could use the HTML-Editor and use there an internal link to the top of the page.. But it seems inconvenient to me.
Isn't there a better way?
A very simple way could be using the Plone inner feature of the document_actions (a tool still available but not used anymore from Plone 4.0 and up).
Go to ZMI, access the portal_actions tool, the document_actions. Now add a new "CMF Action" from the form on the right.
The important information for you is the "URL (Expression)", that must be something like string:#youranchortarget. To fill every other field copy from existing actions.
If you need this link only for a content type or something like this, just play with the "Condition (Expression)".
Links inside this tool are displayed in the plone.abovecontenttitle.documentactions viewlet.
If you want the link on every "page" item, then you could customize the default view's template.

How to modify the Node Edit or Insert Form in Drupal

I am having trouble finding sources of information or example code for a creating a custom module (or any means) to edit the node edit/insert pages.
I am trying to create a Flickr Integration for a node. The Flickr API is not an issue and i can resolve those, it's the Drupal API issues i could use some help or resources of information on.
Here is what i am trying to achive.
User attempts to add or edit a node
User inserts a keyword into a field and presses a button (Get Photos)
Flickr API returns and displays a few images
User clicks on an image and the URL of the image is then added to an input field
on node save or node update a field such as $node->flickrImage[0][value] is updated with the URL selected in 4.
the variable is the available when ever the node is rendered.
I'm not quite sure how to achieve this - I simply need some example code of modifying the node edit/insert pages and I think I can work the rest out.
Please Help!
Thanks,
Shadi
It looks for me, that you can write own CCK field type, so that you can add this to desired content type and process user's input & work with flickr API.
this way, it's easier to manage this field and control it, plus it will be automatically added to node edit/create forms, node loads, etc.
This article might help http://www.lullabot.com/articles/creating-custom-cck-fields
Second way, is to use hook_form_alter
function module_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'product_node_form') {
//do smth
}
}
In this case, form_id you want to change, will be {content_type}_node_form.
there you can add your field, and process it on
hook_nodeapi
Here is a link for node edit form alter solution ..
http://drupal.org/node/101092

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.

Creating content in a block in Drupal 6

By default for creating content a new page is opened. I want to do this inside a block. A block where there will be some fields like title body taxonomy terms and a create content button. How can I do this?
The form block module will do what you want.
You could you do the same thing in code, using hook_block to create a block. And using
drupal_get_form to render the form.
Try the Panels module.
http://drupal.org/project/panels
It will let you override and re-arrange the node add/edit form.
But, as Jeremy stated, to use this form on other pages of the site you will need to do something custom like hook_block and invoke drupal_get_form.
I agree with the answers from Jeremy and Kevin, but want to give another one.
You can use views to create the block! All you have to do is create a new view display with a block display. Add the fields you want to show, add a link field for the node/add/foo link and give it a node id filter or default argument. Here you have to choose the node id of the node to display in the block. Done!
What's nice with this solution? You can use almost every feature of views theming, drag and drop field ordering, adding new fields is cheap and no extra modules. ;)
Regards
Mike

Resources