drupal-7

Drupal 7 FAPI- Adding form elements in validate or submit handlers

懵懂的女人 提交于 2019-12-07 17:33:35
问题 Is it possible to add additional form elements in the validate or submit functions in drupal 7 module? The following code works and image is displayed on the form: function test1_form($form, &$form_state) { $form['image']=array( '#markup'=>'<img src="sites/all/modules/create_ad/th.jpeg"><br/>', //replace with your own image path ); $form['submit'] = array( '#type' => 'submit', '#value' => 'Submit', ); } but when I try to display image after submission in submit function like following, it

TypeError: i.match is not a function

狂风中的少年 提交于 2019-12-07 15:09:55
问题 I have been working on a drupal angularjs module. I have installed bootstrap ui, which is working fine. But when I use modal box it does not work. The code inside the controller: $scope.alertOnEventClick = function( event, allDay, jsEvent, view ){ $scope.alertMessage = (event.title + ' was clicked '); console.log($modal); var modalInstance = $modal.open({ //templateUrl: Drupal.settings.angularjsApp.basePath + '/ng_node/calender/popup', template: "<div class='modal-header'><h3 class='modal

how to override Drupal path from another module

独自空忆成欢 提交于 2019-12-07 14:46:04
问题 I want my module to override the path was set by another module Example: Module A has register a path: $menu['node/%id/test'] = array( 'title' => 'Test', 'page callback' => 'test_A', 'page arguments' => array(1), 'access callback' => 'test_access', 'access arguments' => array(1), 'type' => MENU_LOCAL_TASK, ) Now I create module B and register the same path. $menu['node/%id/test'] = array( 'title' => 'Test', 'page callback' => 'test_B', 'page arguments' => array(1), 'access callback' => 'test

Drupal 7 hook_theme() not loading template file

丶灬走出姿态 提交于 2019-12-07 13:08:55
问题 I'm trying to get a very simple module to load a template file using drupal's hook_theme(). It's pretty much as simple as you can possibly imagine. function sectionheader_theme ( $existing, $type, $theme, $path ) { return array( 'sectionheader' => array( 'variables' => array( 'foo' => NULL ), 'template' => 'sectionheader', ), ); } The template is named sectionheader.tpl.php. The rest of the module is working as expected. I've cleared the Drupal cache. I've inserted a die("Debug") statement in

Drupal 7 - add HTML inside #link form type entry?

笑着哭i 提交于 2019-12-07 11:49:34
问题 I need to add HTML markup to the #title field of a Drupal 7 #type link form element. The output should look roughly like this: <a href="/saveprogress/nojs/123" id="saveprogress-link" class="ajax-processed"> <span data-icon="" aria-hidden="true" class="mymodule_symbol"></span> Save Progress </a> Since I'm doing some ajax forms, I can't just use #markup and l() function. Here's an example without the span: function mymodule_save_progress_link($nid) { return array( '#type' => 'link', '#title' =

set webform component value using hook_form_alter in drupal [closed]

拜拜、爱过 提交于 2019-12-07 09:25:01
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have used form_alter function to change the value of a component but it does not change and default values is stored in the db. when i print the $form the updated values is displaying but not saved in db. <?php

Drupal 7 override jquery js file in custom theme

孤人 提交于 2019-12-07 07:35:23
问题 Is it possible to rewrite/override a default Drupal 7.26 jquery used in custom template scripts variable ? I mean one of the js files: <script type="text/javascript" src="http://drupal.dev/misc/jquery.js?v=1.4.4"></script> by one which comes by custom theme ? I tried this in sites/all/MYTPL/template.php but it doesn't work: $scripts['misc/jquery.js']['data'] = $base_theme . '/js/packages/jquery-2.1.0.min.js'; I would like to know if someone managed it without using any modules such as jQuery

How and where to write Webform submit hook?

牧云@^-^@ 提交于 2019-12-07 07:32:41
问题 I am new to Drupal(7) and hence need some help for following situations. I have created one Webform(I have other webform too) and now instead of inserting in default webform_submitted_data table, I want for this webfrom to insert into myTable. From what I found, I need to write a hook for this. Actually I am getting confused for way to write this hook. I have below questions. Where to write this hook (in which file). How to write this hook only for one webform. Please help and let me know if

How to publish data residing in an external database using Drupal? [closed]

别等时光非礼了梦想. 提交于 2019-12-07 05:00:54
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I'm very new to Drupal and was getting a bit of mixed information about views so I wanted to see if anyone can set me on the right path. Here's my situation. I have a separate database (on the same Drupal database server), that has a lot of data that's maintained by another team. We want to publish that data to

drupal field widget not saving submitted data

流过昼夜 提交于 2019-12-07 03:26:47
问题 I'm trying to create a custom widget but when I submit, Drupal doesn't seem to save any data. When using hook_field_attach_submit() to display what data I've pasted, it is listed as null. Strangely, if i change the #type to be a single textfield instead of a fieldset it will save only the first character of the string that has been entered. This seems like a validation issue, but I'm not sure how to hook into it or to debug the problem. Where can I go from here? <?php function guide_field