drupal-modules

How to hide a field on node data entry form in drupal?

自作多情 提交于 2019-12-23 01:18:35
问题 I'm using hook_node_presave to pre-populate taxonomy field with group's audience value. Thus, I'm trying to hide taxonomy field on a node data entry form. I tried hook_form_alter, but it didn't work for me. Is it possible to hide it? 回答1: <?php function mymodule_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'contenttype_node_form') { unset($form['somefield']); } } ?> This works for me just fine. Just change the form id and key of the form field you are targeting, and the field

Drupal: Are hook_ functions in *.api.php ever called?

故事扮演 提交于 2019-12-22 04:45:18
问题 In Drupal 7, every core module has a *.api.php file, where * is the name of the module. For example modules/node/node.api.php modules/path/path.api.php What are these files for? They contain functions that start with hook_ , and the name of a hook that (I think) the module invokes. For example modules/system/system.api has function hook_entity_view($entity, $type, $view_mode, $langcode) { $entity->content['my_additional_field'] = array( '#markup' => $additional_field, '#weight' => 10, '#theme

How to get rid of Drupal CSS stylesheets?

回眸只為那壹抹淺笑 提交于 2019-12-22 04:08:24
问题 I am trying to accomplish the following. I need to use Drupal 6 as a project requirement, but I want to use it with my own HTML and CSS stylesheets for each node/view/panel etc. The problem is, whatever the theme, I always found that Drupal applies to my HTML content both my CSS stylesheets and the CSS related to the theme chosen. I have also tried, without success, using the stylestripper module (installed in sites/all/modules). No matter what I do, additional CSS stylesheets are applied to

Drupal 7 Browser specific css

时光毁灭记忆、已成空白 提交于 2019-12-18 18:04:13
问题 How can i have a browser specific css in Drupal 7 . I would like to load chrome.css if browser is chrome . Please help 回答1: You can do this in your template.php file with a preprocess_html theme hook and drupal_add_css function. You will find example in drupal 7 theme, for example in bartik : // Add conditional stylesheets for IE drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'preprocess' => FALSE)); drupal

What is the best way to create standards-based, cross-browser compatible rounded corners in Drupal?

吃可爱长大的小学妹 提交于 2019-12-18 13:26:26
问题 I am currently working on a Drupal 6 theme, for which designer is explicitly requesting to use A LOT of rounded corners. I could of course create the rounded corners - traditionally - with images. But I know there must be also better and easier ways of creating rounded corners. Optimally, I would like to write my CSS as standards-compliant CSS3, with selectors like: h2 {border-radius: 8px;} Use of browser-specific is CSS is very OK also, like h2 {-moz-border-radius: 8px; -webkit-border-radius

Drupal Site Download : Not able to install site as-is

陌路散爱 提交于 2019-12-13 20:09:50
问题 I recently downloaded a fully functional drupal(6) site using FTP. Though I installed the Drupal instance, I got the modules and the themes that were in the sites/all folder, but wasn't able to get the actual site configuration ( Configuration and Settings of those modules ) Any help in this regard would be greatly appreciated. 回答1: Assuming this is a follow-on of: Drupal Site install on localhost after downloading source using FTP If you get the Drupal install screen when accessing a site

programmatically get all nodes from drupal 8

戏子无情 提交于 2019-12-13 18:26:49
问题 I am trying to get all nodes of a certian type from drupal. I have tried many ways to achieve that, but maybe due to my lack of Drupal custom module programming experience I couldn't achieve my desire. the closest way that I found on the web, is this: $nids = \Drupal::entityQuery('node')->condition('type','news')->execute(); $nodes = \Drupal\node\Entity\Node::loadMultiple($nids); the first line returns an object of id's the second line returns the nodes of those id's this looks easy and

Send one-time login link via hook_mail

断了今生、忘了曾经 提交于 2019-12-13 17:16:31
问题 This is my first real attempt at a "module" (I recognize that this isn't something fit for contribution back to the drupal community - I'm just trying my hand at getting the APIs to do what I want.) Unfortunately, this isn't working and I'm not sure why. Wonder if anyone has any input on the approach or sees my error(s). My questions: Is there a better way to do this so I don't have to call rsvp_query() more than once? Is this a sensible approach to recursively generating an email for all

What is the opposite of Access Callback user_is_anonymous?

给你一囗甜甜゛ 提交于 2019-12-13 14:40:49
问题 I know that is used in a drupal module to specify that only anonymous users can see that module. What would be the callback that specifies only logged in users ? I have a page that I only want accessible to logged in users. Thank You 回答1: It is the user_is_logged_in() function, which basically checks that the user's ID ($GLOBALS['user']->uid) is greater than zero. The function converts the uid into a Boolean type and returns TRUE for any user that is logged in, because they would have a uid

Views doesn't show checkbox fields where answer > 1

橙三吉。 提交于 2019-12-13 03:39:32
问题 I am using Drupal with Views and the extended profiles module activated. To enable users to check multiple areas of interest I also added a module called Profile Checkboxes. It adds the ability to use a free-form list but turns it into either check boxes or radio buttons. This module works very cleanly and did not present errors. But if a user check multiple interests then those are stored in the profile_values table as a comma seperated value. So if the user likes lets say cars, trucks and