Search code examples
phpdrupal-7content-management-systemrender

Where to find a list of pages automatically renderable in Drupal and how it works?


In the pages .tpl.php of my theme i can find several lines like

   render($action_links)

displaying whole pages with a single command. Sometime i saw that the render argument is a block from my theme .info, but other times i see arguments i cannot identify that render default pages or elements of drupal. How it works? And where i can find a list of default displayable pages?

In particular, i needed to display the content of the default drupal page "add content" in one of my pages, and i'm pretty sure i can do it using this render method, but i cannot find the correct argument.

EDIT: I found something like

 drupal_render(node_add('NODE_TYPE'));

that seems to allow the display of a node add form, but what i need is the main add content page, containing the list of all the type of nodes that a user can add.


Solution

  • Are you new to Drupal? When I read your post, I'm almost sure that you have missed something with the Drupal's working. The variables you found in render() functions are "calculated" somewhere else in the code (in the modules part for the most).

    You cannot find a list of constant variables to display them just like this.

    I found this article about these mysterious variables that are rendered and I hope it will help: http://newsignature.com/articles/the-magic-behind-drupals-render-elements

    If you just want to display the "add content" form somewhere on your site, just call its path (node/add).

    EDIT AFTER CLARIFICATIONS:

    First of all, you can set on which page you want the user lands after login. (I don't know why you're still talking about user profile template. Maybe I missed something again.)

    But if I did understand what you're trying to achieve, I'll do that:

    • Create a menu (or simply use the "Navigation" menu that seems to be exactly what you need) with all the actions users can do. And I'll place this menu in the main content region. Do create a menu, go to Administration>Structure>Menus>Add menu. And add links like "node/add/article" or "node/add/news" or "node/add/page" or whatever your content-types are.
    • Place this menu in the region you want. If you want it to be like the main content of the page, place it in the main container. To do so, go to Administration>Structure>Blocks> Drag and drop your menu in the right region and Save.
    • Configure this block to appear only on the front page (the first page on user arrives after logged in) if you want so. To do so, in the Blocks administration page, click on "Configure" next to your block and check "show block on specific pages: Only the listed pages" and write down <front>
    • Create roles and permissions for your different sorts of users. That will automatically show them the links they are allowed to see. To set permissions, go to Administration>People>Permissions and check in the "Node" section which content-type each role can create.

    I hope I didn't forget anything. Please tell me if it is clear enough.