Questions tagged [drupal-render]

drupal_render() is a function that renders HTML given a structured array tree with a specific structure.

drupal_render() renders HTML given a structured array tree, and it is usually called from within another function, such as drupal_get_form() or node_view().

Rendering arrays are a generalization of the arrays used from the form API. Differently from the latter, they don't use properties to validate the user input, but to render an item on a page.

Related functions

20 questions
13
votes
3 answers

Render a Drupal node

I would like to show a node inside another node. So I retrieve the node id of the second node and I would like to render/print/... it inside another node. But I'm not sure how to do this. I've tried drupal_render, node_view, print,... but with no…
Michiel
  • 7,855
  • 16
  • 61
  • 113
5
votes
4 answers

drupal #default_value not applied in select option in drupal_render

I try to print a drupal 'select option' element in a form .I think drupal_render not applying #default_value.every thing is ok except #default_value not applied. where is the problem?anybody know how i can do this? do #default_value accept string…
Yuseferi
  • 7,931
  • 11
  • 67
  • 103
4
votes
2 answers

Drupal: How to render a span inside a link?

I want this result: This is a link! with a span inside! This renders a link: $render = array( 'link' => array( '#type' => 'link', '#title' => t("This is a link!"), '#href' =>…
tolborg
  • 612
  • 4
  • 21
2
votes
1 answer

Render form in drupal separately

I want to render form in drupal separately, item by item. function form($form){ $form['item1'] = array( 'type' => 'textarea', .........etc $form['item1'] = array( 'type' => 'textarea', .........etc $form['submit'] = array( 'type' => 'submit', …
Laky
  • 745
  • 2
  • 12
  • 25
2
votes
1 answer

Rendering a form together with other content into a Drupal 7 block

I'm trying to render a block in my module that contains both a form and a list of links. I can display one or the other correctly, but apparently do not understand the render array format well enough to get them both rendered at the same time (one…
peetucket
  • 23
  • 1
  • 4
2
votes
1 answer

drupal_render: how to make well-formed div structure of the form?

I noticed, forms "story_node_form" or "node_form" are formed like this: form->div->div->div-standard+div-admin+submin-button My custom content type is not formed this way: I have 49 checkboxes. I placed them with drupal_render() into table like…
EugenA
  • 323
  • 3
  • 14
1
vote
0 answers

Draggable table: drupal_render, render, both yield an empty string for "#weight" types

I am attempting to implement a draggable table in a Drupal 7 module. Whenever I invoke either render() or drupal_render on my element of type #weight, an empty string is returned. The table does render and I am able to drag the rows, but cannot see…
David S.
  • 730
  • 1
  • 7
  • 23
1
vote
2 answers

drupal 7 select field selected value does not work in render form

I need to output one drupal form with other content. Here is my code: $outputs="something else"; $outputs.=render(drupal_get_form(quotes_form)); function quotes_form(){ $form = array(); $form['arrival_city_1'] = array( '#default_value'…
user3210341
  • 77
  • 1
  • 2
  • 14
1
vote
2 answers

How do I properly add an onchange attribute to a form field in Drupal 7

In the module I am coding, I have this code: 'SelectType' => array( '#type' => 'select', '#name' => 'dropdown', '#options' => drupal_map_assoc(array( …
1
vote
1 answer

Display inner html with drupal_render()

How do you display inner html tags using drupal_render() in drupal 7 ? For example, I have an tag inside a and I would like to display just the and not the entire , what do I do ?
ami91
  • 1,284
  • 1
  • 11
  • 20
1
vote
3 answers

Render out file drupal

I have a field called 'field_downloads' which is a file field that allows the user to upload up to 10 files. How can I render these out in page.tpl.php? Below is the output from page.tpl.php: $x =…
LeBlaireau
  • 17,133
  • 33
  • 112
  • 192
0
votes
1 answer

Setting value after returing form in Drupal

I generated form: function test_form($form_state) { $form['hidden'] = array( '#type' => 'hidden', ); $form['submit'] = array( '#type' => 'submit', '#value' => 'Save' ); return $form; } After that I…
Laky
  • 745
  • 2
  • 12
  • 25
0
votes
1 answer

drupal_render returns nothing, depending on previous script and php tags

I created a template, my-node-form.tpl.php, to theme a particular form. If this is the template content, then drupal_render works fine:
moondog
  • 1,537
  • 5
  • 22
  • 34
0
votes
1 answer

drupal_render doesn't render form element

I have this code that implements hook_form_alter for durpal search form and adds couple of new elements there. I have also added theme overwrite code in my template.php for the said form. In addition to this, I also pass form elements there.…
Andrew
  • 1,035
  • 7
  • 22
  • 40
0
votes
1 answer

Drupal form in tabular layout

I am trying to render a tabular layout (html table) for a form such that first cell contains a checkbox. $form = array(); $res = query('SELECT * FROM {mytable}'); $rows = array(); while($row = db_fetch_array($res)){ $record = array(); …
Shoaib Nawaz
  • 2,302
  • 4
  • 29
  • 38
1
2