The render-arrays tag has no wiki summary.
0
votes
0answers
9 views
Is there an updated (living) list of render types?
What I am looking for is
'#type' => ....
I have found a list of available render types in system_element_info() in the api, however what I found is incomplete and the options are either none ...
3
votes
2answers
28 views
How do I nest two field in my node.tpl.php? [duplicate]
I have two fields of multiple values. When I print render($content['field_photo']) and render($content['field_photo_caption']) I get:
<img>
<img>
<img>
<p>caption</p>
...
2
votes
2answers
33 views
Content Type Field value in variable
I've created a content type with some fields like link , address. And I did content-type node theming with name node--machine-name.tpl.php and all fields are printed by this code
<?php print ...
0
votes
0answers
47 views
Dynamically Generating Multiple choice question From search result
I am trying to create a multiple choice question dynamically(radio button) from a page which has the question . Fore testing I have declared the array of question in page(content) as :
0 => ...
2
votes
1answer
31 views
Replacing theme() with render() in a block_view
I'm trying to replace the theme() with render() as recommended:
https://api.drupal.org/api/drupal/includes!theme.inc/function/theme/7
So I started with:
function mymodule_block_view()
{
...
1
vote
1answer
32 views
How does entity_metadata_wrapper work with array?
This is my code to return value of fields in a content type called library
$wrapper = entity_metadata_wrapper('node',$variables['node']);
$variables['name']= ...
0
votes
1answer
42 views
Render array doesn't render children
I can't add a form to a node. Using the following code, the generated HTML show only the node. If I return $form, the form is rendered correctly. What is my mistake ?
function hook_menu() {
...
1
vote
1answer
93 views
How to add a css class to sidebar first render
I am new to drupal theme development . I am customizing a sub theme of zen and wants to change the background of sidebar-first. So I want to know where this sidebar_first render array is defined and ...
0
votes
1answer
19 views
Add referencing entities into this entities renderable array
Lets say I have a taxonomy called bands, and a taxonomy called band_members.
Band_members have an entity reference field relating each band member to a band.
When I view the bands taxonomy term page ...
2
votes
1answer
66 views
How renderable array for an image with style should look like?
I have a custom module that outputs some images. Now, I would like to render them properly.
Currently, I use theme() function, kinda similarly to the way shown here1 and here1:
echo ...
0
votes
0answers
26 views
Is it safe to use $node->field_myfield[$node->language][0]['value']?
I understand that hard-coding "und" is considered as bad-practice and that it is recommended to use the LANGUAGE_NONE constant or better yet, use field_get_items() along with field_view_value(). When ...
0
votes
1answer
63 views
Theme multiple rendered nodes as item_list
I am retrieving/rendering multiple nodes successfully with the following code:
$nodes = node_load_multiple($nids);
$rendered_nodes = node_view_multiple($nodes, 'custom_view_mode');
return ...
-1
votes
1answer
36 views
Problem with storing database queries values in array
I have a simple table with four field email,title,url & status
status can be '0' or '1'
There can be multiple values with status '1'. I want to store the all datas from the table with status ...
0
votes
1answer
71 views
how to display $page array?
How to display the entire $page array like shown below?
I have devel module installed and have tried "dsm($page)" but that just shows the word "Array".
0
votes
1answer
33 views
How do I print out values from a select field with multiple values
Currently I have a select field with multiple string values in a custom node. I'm trying to print them out without any html markup.
Currently I am declaring my variable like this:
$categories = ...
4
votes
2answers
123 views
altering a hook_form_alter function
Is it possible to use hook_form_alter on a hook_form_alter function already defined in another module?
For example... If I want to alter the output of
function ...
2
votes
0answers
155 views
How to: Array of field collection items
Sorry for being a little bit impudent, bit i would need someone to build an array into a code snippet. As I know nearly nothing about php coding, I managed to adept some code I found to get the urls ...
0
votes
2answers
255 views
“Undefined index: und” Error fetching array in node form
I am facing this error in node form when I going to be print title of the body field.
Error:
Notice: Undefined index: und in include() (line 4 of ...
0
votes
0answers
45 views
Removing Node Tabs with _preprocess_page(): Explode string error
Trying to retrieve the array of the Node Tabs (Drupal 7) so I can remove ones if needed (say for a certain role, etc). Currently receiving this error:
Warning: explode() expects parameter 2 to be ...
0
votes
1answer
36 views
need help with drupal arrays [closed]
my array for $var gave me the following $var dump
stdClass Object
(
[vid] => 71
[uid] => 1
[title] => dr1
[log] =>
[status] => 1
...
0
votes
1answer
72 views
How to render a node field
I can get the field using entity_metadata_wrapper like this
$node = node_load($nid);
$node_wrapper = entity_metadata_wrapper('node', $node, array(
'langcode' => $GLOBALS['language'],
...
0
votes
1answer
98 views
“Notice undefined index” for an existing element in $form array
Basically This is my Array
array(
[product_id] => Array
(
[#type] => hidden
[#value] => 39
)
)
and I am trying to get the value ...
0
votes
1answer
720 views
How to convert xml into array in php? [closed]
I want to convert the XML structure below into a PHP array.
<BillingApplyRq>
<FatoryId>xxxxxx</FatoryId>
<TotalNum>2</TotalNum>
<Records>
...
0
votes
1answer
494 views
How to populate a dropdown list from array in FORM API
Hopefully this is clearer, and my last question in a long time!
Using PDO I have connected to an external DB, I can query this and return an array of values, Using html/php I can populate a standard ...
2
votes
2answers
688 views
Commerce - Theme Add-to-Cart form on Product Display page
I have a Drupal Commerce project setup on top of D7-22. I've overridden the template file for my product display (node--product-display.tpl.php), and have managed to render the product fields, as well ...
2
votes
1answer
144 views
Form without <form> tag
I've got a moderation form in the admin section, where a moderator can edit the text, the user has written.
Here is my form:
function phase2_moderation_form($admin, $moderation, $phase2, $edit, ...
0
votes
0answers
38 views
smallest possible render array example
All the docs and answers i read about render arrays dive into the deep before learning to swim. Very frustrating, I would like to have a minimal example.
Assuming this is a valid render array ...
1
vote
1answer
108 views
Get all instances of a content type
Is there a function in D7 to pull all instances of a a specific content type to story in an array? Say I have a content type called "us_states" and I want to pull each instance of that type (and it's ...
0
votes
1answer
120 views
Render Array Javascript with Variables
I'm creating a custom block and I'd like to add some Javascript to it.
I'm using a Render Array to add the Javascript to the page, which works fine, I'm then trying to add some variables to the ...
0
votes
2answers
644 views
How to add a prefix - suffix to a node title from a module
I loaded a renderable array within a hook_block_view. I need to add a prefix and suffix to the title before rendering it. How can I manage to do that ?
1
vote
1answer
94 views
How do I access field variables directly in Drupal 7 without having to drill down into a node array?
I have a view reference field and have some php code in the view where it grabs the taxonomy ID of the page its currently on. Currently I am grabbing the TID via
...
1
vote
1answer
154 views
theme_field() render array
I hoped the documentation for theme_field() would tell me how to create a render array that may be parsed by that function.
Based on that, I thought something like this would work.
return array(
...
0
votes
1answer
98 views
How to rewrite the value of an array element in page.tpl.php
I'm totally new to PHP programming and modifying the values of Drupal output with php customisations, so sorry if this question seems dumb.
In Drupal 6 I need to rewrite the value of the array ...
-1
votes
2answers
752 views
Strict warning: Only variables should be passed by reference [closed]
I am getting this error on this line in my code. I'm guessing I need to break this line down a bit. Any comments would be great.
$promobox_id = reset(array_keys($result['fieldable_panels_pane']));
0
votes
1answer
129 views
Specify which theme to use when rendering a page with drupal_render_page()
I'm looking to send out a node as an HTML email. I have the code working except for one part.
I'm using drupal_render_page() to render the page's content so it's ready for an HTML email. I thought ...
0
votes
0answers
97 views
Can't render taxonomy term from block array
I am rendering variables from a block array, but for some reason when I render a taxonomy term, I get the white screen of death.
I am using views_get_view() to get the value assigned to ...
0
votes
1answer
34 views
How can I insert conditional logic into a render array?
Given the following render array, I'd like to insert some logic so that that $number of rows are created, but I can't just insert a for loop in the middle of defining my render array, I don't think. ...
0
votes
0answers
41 views
render array caching per node
I have a few render arrays inside hook_node_view which I'd like to cache. I'm doing something similar to the below:
$my_item = array(
'#theme' => 'item_list',
'#items' => array(),
...