drupal-7

Retrieving a list from Content Type field in Drupal 7

橙三吉。 提交于 2021-02-04 19:48:45
问题 I'm sort of new to Drupal 7. I am using Drupal Form API and I need to use a drop-down showing a list of states via the mymodule_forms hook. $form['work_state'] = array( '#title' => t('Work State'), '#type' => 'select', ... ); I already have a list of states defined in a Content Type field. How would one go around loading the Content Type (ie: forms_stipend) and retrieving the field (ie: field_states). After that is retrieved, I can start populating the available list of states into the code

Dynamically filter images in Drupal 7

自古美人都是妖i 提交于 2021-01-29 18:12:13
问题 I am trying to build a custom module in Drupal 7 that allows a user to upload an image and apply a filter. In particular, I am trying to adjust the contrast. The user can adjust the contrast via an HTML slidecontainer which will adjust the CSS contrast on the image. On submit the contrast value will be sent to the server, and applied to the image via the imagefilter() function in the GD library. My problem is that I cannot replicate the resulting CSS filter with the imagefilter() method in

Drupal Page returning 502 error page instead of 404

孤者浪人 提交于 2021-01-29 08:06:49
问题 When I am searching for a link from my drupal website https://example.com/index2.php?option=com_ckforms&view=ckforms&id=1&Itemid=190 i am getting 502(bad gateway) response and redirecting to 502 nginx error page instead of 404 as 5xx errors are reserved for actual service errors. I am getting "upstream sent unsupported FastCGI protocol version: 72 while reading response header from upstream" error in logs. I found that the reason could be- This server (Web Front-End) received an invalid

finding out what is causing dreaded “The website encountered an unexpected error. Please try again later.” message

こ雲淡風輕ζ 提交于 2020-06-10 02:58:05
问题 while doing a drupal 6 to 7 upgrade I am getting the not so helpful message "The website encountered an unexpected error. Please try again later." everytime I go to certain pages. ex) /admin/config What is the best way to find out what is causing the fatal error so that I can fix it? All I can think of right now is to start disabling contributed modules until that page works or looking through the logs. Thanks. 回答1: If dlog/watchdog and php error log aren't working, try this: go on /includes

Drupal 7 + jQuery, how to get jQuery to interact only with the active node (via nid) and not every node in the list

人盡茶涼 提交于 2020-01-24 03:49:08
问题 I've been searching for a very long time without any luck within the subject, please point me in the right direction if I have been missing an older thread. What I'm trying to achieve: Having a regular view of multiple nodes and by pressing a button (or whatever) within a node make jQuery interact with this specific node in any way. Ex. make a hidden div appear. The problems I'm facing are for starters that I'm still finding it hard to work with jQuery together with D7. I've been using jQ for

Checkboxes with watchdog_severity_levels()

﹥>﹥吖頭↗ 提交于 2020-01-17 12:23:09
问题 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

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