drupal-7

Render a Drupal node

限于喜欢 提交于 2019-12-04 23:47:48
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 results. Any advice? $nid = $node->field_linked_fiche['und'][0]['nid']; $fullFiche = node_load($nid); EDIT - the whole template <?php /** * @file * Bartik's theme implementation to display a single Drupal page. * ... */ ?> <div id="page-wrapper"><div id="page"> <div id="header" class="<?php print $secondary_menu ? 'with-secondary-menu': 'without

How do I get PagerDefault queries to work correctly with Drupal 7?

时光毁灭记忆、已成空白 提交于 2019-12-04 23:29:51
问题 I'm running the following code: $query = db_select('taxonomy_index', 'ti') ->fields('ti', array('nid')) ->condition('ti.tid', $term->tid) ->condition('n.status', 1); $query->join('node', 'n', 'n.nid = ti.nid'); $query->extend('PagerDefault')->limit(2); $nids = $query->execute()->fetchCol(); but the pager does not work: every item from the query is returned, as if the call to PagerDefault is completely ignored. I am outputting theme('pager') further down in the output so that's not the problem

How to set a placeholder in drupal 7 on a login form

Deadly 提交于 2019-12-04 22:59:27
I need to set a placeholder for a horizontal login form in Drupal 7. This text needs to disappear when clicked on. They will just say 'username' and 'password'. Here is the code for the form as of now. Thanks! function horizontal_login_block($form) { $form['#action'] = url($_GET['q'], array('query' => drupal_get_destination())); $form['#id'] = 'horizontal-login-block'; $form['#validate'] = user_login_default_validators(); $form['#submit'][] = 'user_login_submit'; $form['#prefix'] = '<div id="loginbar">'; $form['#suffix'] = '</div>'; $form['name'] = array( '#type' => 'textfield', '#prefix' => '

How to allow multiple blocks in a module of Drupal

若如初见. 提交于 2019-12-04 22:07:27
I am trying to make a module for Drupal 7 that provides a block and has certain configuration settings. Now what I want is that I want to provide 5 blocks to the user so that they can use different settings in each block. In other words, I want to provide each block a separate set of settings. How can I do that? Edit: Actually I have made a module that shows a single block. If you have used superfish menu module then you can see there that they allow us an option to choose how many block should be made available. So that for each block we can use different menu to show. I am talking about that

How can I redirect a Drupal user after they create new content

拜拜、爱过 提交于 2019-12-04 21:09:18
I want to redirect my users after they create a piece of new content, instead of directing them to the 'view' page for the content. I have seen mention of using hook_alter or something, but I'm really new to drupal and not even sure what that means? Thanks! As you mention that you are new to Drupal, I'd suggest to take a look at the Rules module . You can add a trigger on for content has been saved/updated and add an action, to redirect the user to a specific page. You can however do the same in a light weight custom module using a form_alter hook. First, find the form ID of the form. For node

How can I upload multiple files with drupal 7?

微笑、不失礼 提交于 2019-12-04 19:36:18
I'm making a drupal 7 module that contains a form and I would like to upload multiple files in a row. Currently I'm using a managed_file type of input field. $form['attachment'] = array( '#title' => t('Attachment'), '#type' => 'managed_file', '#default_value' => variable_get('attachment', ''), '#upload_location' => 'public://perm/', ); This gives me the upload button, but only lets me upload one file. Is there a way I can tell this form to upload a file and still keep the option for a second upload open? check out the new ajax system, it's pretty easy to implement, it should allow you to

Drupal login form customize

好久不见. 提交于 2019-12-04 19:35:35
Hi i have used this code <?php $elements = drupal_get_form("user_login"); $form = drupal_render($elements); echo $form; ?> to get the default Drupal login form for my site but I need to customize the HTML, I have found some pages in module/users but did not understand how to customize the structure. use this in template.php function themename_theme() { $items = array(); $items['user_login'] = array( 'render element' => 'form', 'path' => drupal_get_path('theme', 'corporateclean') . '/templates', 'template' => 'user-login', ); and create a template folder and within that create a file user-login

How to theme a menu block in Drupal?

喜欢而已 提交于 2019-12-04 19:25:20
This should really be a basic question but I simply don't get it after hours of searching. The question is, how do I theme menu blocks in Drupal 7? I've created three different blocks all based on the main menu. Now I want to: create unique HTML for all three blocks, that means modifing the surrounding wrapper and the <ul> and <li> that builds the menu. I wanna set special classes and remove all of the Drupal-added stuff attach different classes to the different levels within each block. One of blocks will show two levels of the menu, i.e. it will display a submenu. I want to set a special

Upload multiple files in Drupal 7

纵然是瞬间 提交于 2019-12-04 18:52:45
问题 The Image Field only allows one file at a time to be uploaded. Is there a module that enables multi-upload in Drupal 7? 回答1: Comparation of upload modules: http://groups.drupal.org/node/155764 I use this modules: Multiupload Filefield Widget and for images Multiupload Imagefield Widget 回答2: If you just want to upload multiple files per node, you can edit the image field settings to allow that. Go to Home » Administration » Structure » Content types » [Content type] » Manage fields then edit

How to apply multiple styles to one element in ckeditor?

回眸只為那壹抹淺笑 提交于 2019-12-04 17:26:02
I want to integrate some bootstrap classes to my ckeditor profile: { name : 'Button Large' , element : 'a', attributes : { 'class' : 'btn-lg' } }, { name : 'Button Primary' , element : 'a', attributes : { 'class' : 'btn-primary' } }, but the problem is those styles cant be combined. If I want a button which is btn-primary AND btn-lg I would have to create a third style: { name : 'Button Large Primary' , element : 'a', attributes : { 'class' : 'btn-lg btn-primary' } }, which obviously is quite redundant for many buttons and not necessary. So how can you do this? Using CKeditor 4.4.3 Antares42