drupal-7

Drupal 7:Pathauto patterns from menu structure hierarchy

白昼怎懂夜的黑 提交于 2019-12-03 08:09:34
I'm trying to create a Pathauto pattern which looks like "Drupal root/parent_menu_item_name/node_title" where "node_title" is a child of "parent_menu_item_name" in the menu hierarchy. I've tried many different variations, and nothing works. I've tried the suggestions in Menu path in Pathauto , and none of them works at all. It just ends up outputting the node-title, with nothing before it. I've got the latest versions of the Token and Pathauto modules installed. Dylan Spencer James I believe this question has been answered by Kenan: Kenan's answer [node:menu-link:parent:url:path]/[node:title]

Facebook Chat Bot - How do I test the welcome message?

随声附和 提交于 2019-12-03 07:53:37
My chat bot is working great but I am having trouble debugging the Welcome message functionality because it only shows up when a conversation is initiated (although i'm pretty sure it's not working having tried it on a colleagues phone). How do I reset my chat so it sees me as a new user interacting with it? This is my welcome PHP Script at the moment <?php function webhook() { $challenge = $_REQUEST['hub_challenge']; $verify_token = $_REQUEST['hub_verify_token']; if ($verify_token === 'MYTOKEN') { echo $challenge; } $input = json_decode(file_get_contents('php://input'), true); $sender =

drupal: Form API, dynamically hide or show fields based on input

蹲街弑〆低调 提交于 2019-12-03 06:39:06
I'm building a form module. One of the early fields is a set of radio buttons. By default the first button is selected. Next I'll have a series of select boxes. One needs to be visible, the others invisible. Then as the user selects a different radio button I want different select boxes to show or hide. How can I hide the field and label by default and show it later dependent upon which radio button (or another select box option for that matter) is chosen? You can use the #states property to achieve that. The #states property can be applied to all Form API elements. Here's the documentation

Drupal 7 Default .htaccess

我只是一个虾纸丫 提交于 2019-12-03 06:11:28
I am after the default .htaccess code for Drupal 7, for some reason the install did not update the .htaccess file at all and it is blank. Any help would be greatly appreciated as I can't find this anywhere. Actually, the official Drupal source code is on GitHub: https://github.com/drupal/drupal . The requested .htaccess file can be found here . 来源: https://stackoverflow.com/questions/5864861/drupal-7-default-htaccess

Drupal Commerce Line Items: alter the price?

坚强是说给别人听的谎言 提交于 2019-12-03 06:10:05
问题 I have to add to my cart some line items with a custom amount. The commerce product is saved with price = 0, and my module compute the price and add the line item to the cart/order, but i dont understand how to set programmatically the price. I've read about using Rules, but I need my module to be able to set/alter the price, without invoking rules . I've tryed with an entity wrapper, i tryed to alter the line item created with commerce_product_line_item_new(), but nothing, when the line item

Menu path in Pathauto

痴心易碎 提交于 2019-12-03 05:38:36
问题 How do I get pathauto under Drupal 7 to generate a URL alias by the full menu path? 回答1: Just an update in case anyone comes across this with a more recent version of Pathauto/Token. This worked for me: [node:menu-link:parents:join-path]/[node:menu-link] 回答2: I ended up using: [node:menu-link:parent:url:path]/[node:menu-link] Heavy caution though: If the node does not have a menu link, you'll end up without an automatically aliased page. On the bright side, this might make you aware of orphan

Drupal 7: Access custom node field in page.tpl.php

狂风中的少年 提交于 2019-12-03 05:21:34
问题 I added a new field "mood" (image) to the page content type. Is there any way to access the image stored in this field in the page.tpl.php? 回答1: Should be $node = node_load($nid); $node->field_mood[$node->language][0]['value']; 回答2: There is a new "field_get_items()" function in drupal 7. The $node variable should already be defined in page.tpl so the first line may not be required. This will get the field in the appropriate language. There is also an optional parameter to specify the desired

Drupal 7: Best Practice for a Dynamic Select List in Drupal 7

十年热恋 提交于 2019-12-03 05:21:33
问题 What is the best practice for a dynamic select list in Drupal 7? Create a Field with dummy options via the UI and overriding the options with hook_form_FORM_ID_alter or Creating a dynamic select list from scratch via a custom module with the hook_form or different approach? Thanks 回答1: You could use Form API's #ajax (it used to be called #ahah in Drupal6) to do that. Here is an example for Drupal 7 (based on Examples for Developers) that shows two dropdowns where the first dropdown modifies

Drupal 7: Modifying menu HTML output?

泪湿孤枕 提交于 2019-12-03 05:05:23
I am trying to modify the HTML output in a Drupal 7 theme that I am creating. Basically, instead of the < li >s containing just plain < a >s with text, I want to include some additional HTML inside the < a >. I know that it's possible to modify the HTML created by the menus in Drupal. I can see the following call in page.tpl.php: <?php print theme('links__system_main_menu', array( 'links' => $main_menu, 'attributes' => array( 'id' => 'main-menu', 'class' => array('links', 'clearfix'), ), 'heading' => array( 'text' => t(''), 'level' => 'h2', 'class' => array('element-invisible'), ), )); ?>

Style Drupal 7 log-in page

谁都会走 提交于 2019-12-03 03:39:50
How do I style the login-page of Drupal 7? I used different methods like page-user-login.tpl or user-login.tpl of page-login.tpl but with no results. Is there an easy way to theme your login page in Drupal 7 in his own .tpl -file? You can override any page template by naming your templates in the following convention: For page 'user/login': page--user--login.tpl.php For page 'foo/bar/' page--foo--bar.tpl.php See Core templates and About overriding themable output for more information. Remember to clear Drupal's caches once you add a new template file so the theme registry has a chance to pick