drupal-7

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

How do I add custom fields in a view?

北慕城南 提交于 2020-01-13 20:22:45
问题 I have created a view in Drupal 7, and used "Table" as format. How can I add my own fields to that table? 回答1: One method is, in your view, click 'add' for fields, then filter by 'Global', and you will get 4 types of custom fields to add. Global: Contextual Links Global: Custom text Global: Math expression Global: View result counter Another method is to make use of Views Custom Field module. 来源: https://stackoverflow.com/questions/15162343/how-do-i-add-custom-fields-in-a-view

Drupal 7: Rename files on upload (via filefield)

半腔热情 提交于 2020-01-13 14:54:10
问题 I am looking for a way to rename files that are uploaded by users through a filefield. For example, rename user profile photos using uniqid . I found a good solution for D6 at "Drupal 6: How to Change Filename on Upload" but can't find anything for D7. Another option is to use File (Field) Paths, but: The module causes warnings on my setup. Seems to be a bit of an overkill to install a general module for a very specific purpose. 回答1: You can change every file upload by hook_file_presave as

hook_preprocess_page() does not seem to use the suggested template file

霸气de小男生 提交于 2020-01-07 04:03:09
问题 I am suggesting a template file in the hook_preprocess_page() implementation done from a module, but the suggested template file doesn't seem to be used. The template file is page--terminal-template.tpl.php, which is in the directory containing the module, and this is the implementation of hook_preprocess_page() . function terminal_preprocess_page(&$variables) { if (arg(0) == "terminal") { $variables['theme_hook_suggestions'][] = "page__terminal_template"; } } Could anyone please help me? 回答1

Drupal hook_url_inbound_alter not altering my url

寵の児 提交于 2020-01-06 17:09:07
问题 I have in my module named 'categorie' a implementation of: function categorie_url_inbound_alter(&$result, $path, $path_language) { if ($path == 'e') { $result = 'user'; } } I'm planning to do something a bit more advanced but I can't even seem to get the basic one working. With this implementation I expect that if a user goes to mysite.com/e , he gets the user page. But I'm getting a 404. In this topic:Using module: url_alter and it's hook: hook_url_outbound_alter() they also suggested you

relations variable of content-type drupal 7

送分小仙女□ 提交于 2020-01-06 15:53:32
问题 I have created a content type called Customer. I am creating other content called reports. A customer has several reports. How could create a variable in the content-type reports relations with the customer's name on content-type customer? thanks 回答1: You should use Drupal Entity Reference module. Download, install and enable it, and then, you have to add a new field in content type "Reports", namely customer, of type "Entity reference" (this field type was added by Entity Reference module).

drupal 7 form validate add class?

狂风中的少年 提交于 2020-01-06 13:26:24
问题 In my form I create a checkbox $form['existing_customer'] = array( '#type' => 'checkbox', '#title' => t('Are you an existing customer?') ); When I validate it using hook_validate I would like to add a class to the label? Any ideas how to achieve this? 回答1: I can't imagine why you'd want to do this in a validation function, and I think there's a far easier way to accomplish what you're trying to do. Each element in a Drupal form is wrapped with a container (which has an ID). Inside this

drupal 7 form validate add class?

孤街浪徒 提交于 2020-01-06 13:26:13
问题 In my form I create a checkbox $form['existing_customer'] = array( '#type' => 'checkbox', '#title' => t('Are you an existing customer?') ); When I validate it using hook_validate I would like to add a class to the label? Any ideas how to achieve this? 回答1: I can't imagine why you'd want to do this in a validation function, and I think there's a far easier way to accomplish what you're trying to do. Each element in a Drupal form is wrapped with a container (which has an ID). Inside this

How to add KMZ file in drupal 7?

我的梦境 提交于 2020-01-06 07:10:14
问题 I have got KMZ file and I don't know how to show it from drupal. So, I research and found those codes. function CoverageMap() { var map = new google.maps.Map(document.getElementById('coverageMap'), { zoom: 15, center: {lat: 16.800915763233845, lng: 96.1567211141123} }); var kmzLayer = new google.maps.KmlLayer('http://test.dev/sites/all/themes/bootstrap_business/coverage/ygn_mdy.kmz'); kmzLayer.setMap(map); } I put this code and save the file Coverage.js . But, the file location is static

How to remove permissions offline_access and publish_stream in scope variable

扶醉桌前 提交于 2020-01-06 01:05:12
问题 I have error when I want login drupal 7 with facebook account and I use module hybridauth. like this: Invalid Scopes: offline_access, publish_stream. This message is only shown to developers. Users of your app will ignore these permissions if present. Please read the documentation for valid permissions at: https://developers.facebook.com/docs/facebook-login/permissions From same question I found the answer and it is to remove permissions offline_access and publish_stream in scope variable but