cck

Drupal: create a node with employee working hours

陌路散爱 提交于 2019-12-11 00:17:17
问题 I have a bit complicated task. 1. I need to create a node with employee working hours (it's gonna be created for all users with role "employee"), which looks like this: Monday: From __ : __ To __ : __ Tuesday: From __ : __ To __ : __ Wednesday: From __ : __ To __ : __ etc. So, I'll have to create probably 14 CCK fields (monday_from, monday_to, tuesday_from...) or more to store the day of the week and workging hours (hours and minutes). 2. I need to add a view with exposed filters, where

Changing CCK Title for Form

陌路散爱 提交于 2019-12-10 21:18:36
问题 By default a CCK form creation has a title of the form Create [Your Content Type Name Here] I want to change mine to Register for Such and Such It was suggested that I could use string-override, but I can't find the string to replace. I've also tried writing code to form_alter, but can't seem to figure out how to get the "title" to change. Ideas? 回答1: There are two possibilities, either you can use the theming laying and set $title variable used in the page templage. You can do this with a

How do I set the value for a CCK Node-reference field automatically when create form submits

无人久伴 提交于 2019-12-10 20:51:33
问题 I have a content type (A) that references a single node of a different content type (B). The node referenced (B) can be programmatically determined using the information for the user creating this new node (A)... Each user can only create a single node of the referenced content type (B), so this single node will always be referenced from nodes of content type B that the user creates. Because the referenced node is always known, I don't want the user to have to enter the reference value, I

How remove node ID [nid:n] in NodeReference fields

给你一囗甜甜゛ 提交于 2019-12-08 01:56:15
问题 This is the same question of this link: Removing [nid:n] in nodereference autocomplete According with the first answer (Grayside) I've created my own module and activated. Then I create a new content, I look sth up in the nodereference field and finally select it -> it works (Doesn't appear the [nid:n]). But, when I view/preview or save or edit the content, the [nid:n] appears again. Anybody can help me? 回答1: When viewing the node, it is the theming function for the field that determines what

How to list CCK fields by content type in Drupal

泄露秘密 提交于 2019-12-07 00:58:58
问题 To get a list of a content type's cck fields, I was hoping to use: drupal_get_schema('content_type_mycontenttype'); but that leaves out fields with multiple values. Is there a simple call to use to get such a list? 回答1: Take a look at the content_fields function, and if doesn't that have the information you need, there is _content_type_info. Additionally, once you have the field information, you can extract the table storage and column names using content_database_info. 回答2: For Drupal 7,

How to get the field values of a content type in drupal

和自甴很熟 提交于 2019-12-06 08:09:34
How can I get the field value of a custom content type. I have created a custom content type using the CCK module. Is there any function to get the array of the fields of a particular content type. For example: I can get the profile details using content_profile_load() function. Is there any function similar to this. If you are viewing the node, the values are all stored in the $node variable. Do a print_r($node); to see all the available values in the node object. Otherwise use node_load() to load a node object. More on node_load(): http://api.drupal.org/api/drupal/modules--node--node.module

Create multiple CCK nodes with single custom form in Drupal

元气小坏坏 提交于 2019-12-05 21:39:02
I need a form which will allow creation of several related nodes at the same time. All of the nodes involve CCK fields. I would like to use as much of CCK's built-in validation, submission, input widget, and security functionality as possible/practical. What is the best way to accomplish this in Drupal 6? Are there 'best practices' or docs anywhere? Here are 3 possibilities I can see. I would love feedback on whether any of these would work, or if there are even better options. 1. start with the standard node creation form for content type foo. modify the form by adding fields for content type

Add CCK field to custom form in Drupal 7

℡╲_俬逩灬. 提交于 2019-12-05 11:31:13
There was a method with CCK in Drupal 6 to attach a CCK field in our custom form, like: $field = content_fields('field_name'); // field_name is cck field (text_field,text_Area,image_field anything.) $form['#field_info'][$name] = $field; $form += content_field_form($form, $form_state, $field); How can I achieve the same functionality in Drupal 7? I had a form and I want to use the field that I created for a content type. I went through all the files of field.module but couldn't find anything. There are functions in it like _attach_field , field_info_Field and field_info_instance , but they can

Drupal Custom CCK field with multiple child fields

跟風遠走 提交于 2019-12-05 01:18:15
问题 Is there a way of creating a composite field that can have multiple values, with each value having another group of composite values? E.g. we want to have this structure at the end: Group 1 (unlimited number of groups) Child field (unlimited children for each group) Child field ... Group 2 Child field Child field ... ... Is this possible at all for a custom module that defines a CCK field? If so, can someone push me in the right direction? 回答1: this is a very know and debated issue in the

Is it possible to customise drupal node reference and pass your search and a argument from another field

ε祈祈猫儿з 提交于 2019-12-04 15:26:29
I'm trying to create a bespoke form in drupal, with a node reference field. I'd like to add a little extra functionality to the node reference auto complete. I've created a view, that contains an argument. I'd like to be able to pass that argument from a drop down as well as the typed text into the autocomplete script. Does anyone know how I'd start this off. /* FIELD 1 - the drop down */ $sql = "SELECT nid, title FROM node where type='resourcetype' AND status =1 order by title "; $result = db_query($sql); $counter = 0 ; $options = array(); while ($data = db_fetch_array($result)) { // krumo (