drupal

Checkboxes with watchdog_severity_levels()

て烟熏妆下的殇ゞ 提交于 2020-01-17 12:23:06
问题 I have this code that gets me out some checkboxes with the watchdog severities: /** * Checkbox for errors, alerts, e.t.c */ foreach (watchdog_severity_levels() as $severity => $description) { $key = 'severity_errors' . $severity; $form['severity_errors'][$key] = array( '#type' => 'checkbox', '#title' => t('@description', array('@description' => drupal_ucfirst($description))), '#default_value' => variable_get($key, array()), ); return system_settings_form($form); } I set this $key in my code

How to create array of all the language in drupal form dropdown list

与世无争的帅哥 提交于 2020-01-17 06:15:54
问题 I need to create dropdown list for all languages in my Drupal form, Is there any function in PHP to achieve this. I want to create an array of all languages and pass it to drupal form. function video_upload_subtitles_form($form, &$form_state) { $form = array('#attributes' => array('enctype' => 'multipart/form-data')); $lang_list = array();//**how to create this array** $form['video_name'] = array( '#title' => t('Name Of the video'), '#type' => 'textfield', ); $form['sub_file'] = array( '#type

Customize a field output

流过昼夜 提交于 2020-01-17 05:17:29
问题 I have a field named "field_enroll_link." I want to remove all the surrounding divs and just print the field content (it will go into the href of an anchor tag). I created the files "field--field_enroll_link-course.tpl.php" and "field--field-enroll-link-course.tpl.php," and put it into my template folder. It just contained <?php print render($item); ?> , but when I cleared the cached and even switched the themes, I'm still getting all the surrounding divs and markups. How do I override the

Theme user registration page in Drupal 6 with an Omega subtheme

雨燕双飞 提交于 2020-01-17 04:42:46
问题 I´ve found numerous tutorials on how to do this on D6, BUT, it seems that the example code I´ve found doesn´t quite work on Omega subtheme. Here´s the code I´ve found it suits me best (via Trellon): Inside template.tpl.php: <?php function themename_theme($existing, $type, $theme, $path) { return array( ... // tell Drupal what template to use for the user register form 'user_register' => array( 'arguments' => array('form' => NULL), 'template' => 'user-register', // this is the name of the

Drupal 6 Validation for Form Callback Function

岁酱吖の 提交于 2020-01-17 03:27:12
问题 I have a simple form with a select menu on the node display page. Is there an easy way to validate the form in my callback function? By validation I don't mean anything advanced, just to check that the values actually existed in the form array. For example, without ajax, if my select menu has 3 items and I add a 4th item and try to submit the form, drupal will give an error saying something similar to "an illegal choice was made, please contact the admin." With ajax this 4th item you created

Populate twig template from external api

孤者浪人 提交于 2020-01-17 03:05:30
问题 I am building a Drupal 8 site and am new to the twig templating engine. For one specific content type I would like to make a call to an external restful api and render some of the returned data as fields in the twig template. I have an internal id to call out to the API and I would like to embed in the template: The api call set a number of variables from the call render the result (with some logic if it does not exist) Is this something that is easy to do with twig and drupal 8? As a

Drupal - Creating 'add another' buttons on node edit forms that will retain node relationships

流过昼夜 提交于 2020-01-16 19:25:06
问题 I'm attaching images to a content type - 'marketplace item' - using the node reference url widget. The technique is outlined in full here: http://drupal.org/node/599672 My goal is to add an extra button to the image node edit form that will allow users to save and add another image node, retaining the node references/relationships for this new image node . Therefore the buttons will be: [Save] [Add another image] [Preview] There are modules that provide 'add another' functionality (here and

drupal jQuery 1.4 on specific pages

萝らか妹 提交于 2020-01-16 00:40:50
问题 jQuery 1.4 breaks various modules and is not ready to replace 1.3.2 wholesale. But on various pages with complex javascript interactions, I need 1.4. What's a good way to force drupal to use 1.4 on specific pages? Thanks. 回答1: Take a look at this post, the author describes replacing a js file using hook_theme_registry_alter and a preprocess function. http://www.mediacurrent.com/blogs/remove-or-replace-jscss-page 回答2: jquery_update is a great way to get 1.3.2 (up from 1.2.6) on D6. You can

drupal_http_request returns error code

谁说我不能喝 提交于 2020-01-15 20:23:53
问题 I have three website Main ,a, b. If you logged in through "Main" website then i will enable session for websites "a", "b". So this is working fine. When user logged out of Main Website, i have to loggout of other two website "a", "b". There are two different logout url for the other two website so i am calling those two website's logout url in the Main website's logout function using drupal_http_request Example CODE: // this is the function where main website session are destroyed function

How to display sibling pages except current page in drupal 7?

给你一囗甜甜゛ 提交于 2020-01-15 18:51:26
问题 Suppose I have parent pages A1 and B1. A1 has child pages A1.1, A1.2,A1.3 and B1 has child pages B1.1, B1.2. When I am on page A1.1 I shall be able to display A1.2 and A1.3. Same for A1.2, I shall be able to see A1.1 and A1.3. If I am on page B1.1, I shall see B1.2 and vice versa. Note: Every page has an image and a title. I want to get a solution using views. This thread may be linked to this link if we need the child pages: How to list all child pages of current parent page in drupal 7? 回答1