I have a custom field in custom module (A) and i want to move this field to custom module (B) as we are not going to use module (A) anymore.
Is that possible to achieve?
Create the field in B.
With an sql query, copy the values from field in A to field in B.
Delete field in A.
Related
I have an employee content type and it have an id field.
Can I make the id field unique (so that Drupal would prevent me from inputting the same id more than once by mistake)?
You could try the field validation module. It allows you to set a field as unique on per content type basis.
Alternatively, if you have access to/are a developer, then it's quite simple to alter the form and include your own validation.
You can use the contrib module unique_content_field_validation
I know it is possible in plone to create content types with their own fields.
So, is it possible to create a collection with those fields?
I'm not sure what you like to achieve, but to answer your question:
Yes it's possible to create a collection based type with your own fields.
If you are using the DX based collection type of plone.app.contenttypes you can easily extend it. You also have to register your own view template, which takes care of the new fields.
Of course it is also possible to create a completely new content type.
Check the Collection FTI of plone.app.contenttypes
You also need some basic knowledge about dexterity
If you ment to extend the possibly choosable criteria of collections by any field-names of your portal's contenttypes and you are using the old-style collections (type_name=Topic), you can do like this, to add any of these fields as a choosable criterion to (old-style-)collections:
Make sure, the field is registered in the portal_catalog, which you can check by accessing http://yourhost.com:8080/Plonesitename/portal_catalog/manage_catalogIndexes. If it's not already there, you need to add it via the dropdown-selection in the upper right corner, choose "Field Index".
Make sure, the field is registered in the configuration of collections, which you can check by accessing http://yourhost.com:8080/Plonesitename/portal_atct/atct_manageTopicIndex. If it's not there, click on "All fields" in the upper right corner, search for the field-name and check the radiobox to make it available, save.
In newer Plone-versions the old-style-collections are disabled by default, you'll probably need to enable them via http://yourhost.com:8080/Plonesitename/portal_types/Topic/manage_propertiesForm, check "Implicitly addable", save.
Is it possible in Drupal to find out which user modified a particular field? Not just the whole node. After saving the content I want to display the author name next to that field.
Not sure if this is possible or not.
This is not provided by Drupal core, and (As far as I know) it is not provided by any contributed modules on drupal.org.
So, in order to do that, you would probably need to create a custom module.
A simple module to achieve that would have a database table with (nid, uid, current field value) and hook_node_presave implementation (compare field values, then update/insert/ignore saving new data to your database table).
I wanted to create a new module in my copy of Sugar CRM. I selected a package, and went to create a new module (using module builder). The last field in the form asks to select a module type . If we select module type, say, user, then around 10-15 fields comes up in the module. These cannot be edited. But I wanted to create a module which would consists of only those elements I wanted to. So is there any way to create a new module without having those fields?
For example, I wanted to create a module called 'donation' which would contain the list of all donations made by the users (1 'User' can make MANY 'donation'). Since user field will
always contain all the user detail (example, first name, last name, email etc), so we do not repeat them for each donations made by the user. So donation module should contain only field like
["user-id", "donation-amount", "payment-method", "cc-number"].
Any Sugar usercan help me in this issue?
Thanks.
Just simply hide the unwanted fields on the various views. Some of these fields are basically required by the framework in one way or another (name, date_modified, etc). But it doesn't mean that you need to utilize them. The other additional fields could be removed from the vardefs.php if desired, but it isn't worth the hassle usually.
What I am trying to do here is controlling how a group of fields are showing up on node view. I don't want to control them by user role, as this is going to be a node level permission and I don't want these permissions affect other nodes with the same content type.
For example imagine I have three different roles: ROLEA, ROLEB and ROLEC. Each role has it's own permissions set for accessing to fields. When a node is created for the first time, a user with role of ROLEA, can see couple of fields and can edit the value of those fields. When node is published, a rule/action get called through Rules module, and will set a status field in that node to STAGE1. After this event (a new node created), if user (ROLEA) goes to that node that was just created by herself, those fields that were editable before, should be read-only now. This means when Rules module, set the value of the status field to STAGE1, when that node wants to get loaded by Drupal, we need to check the status value, and based on that if it was for example STAGE1, modify some other field in that particular node, read only or editable, or in some cases hide them from user. So my guess is to create a module that every time a node of that type, is loading, check the status field (which is a field that we have created in that node type) and based on the value of that field, decide which node should show up or hide. This should override the permission that have been set for those fields on that particular node type.
What I am trying to do is creating a method to control which field is going to be read only /editable / hidden based on the value of a specific field in that content type, which has been set by Roules module, based on different stages of working on that node by different group of users. I am not using Organic Group. I use Drupal 7 and Rules module and couple of other permission related modules. But I found that there is no such a way to handle field visibility in node level, separate from user roles.
Do you think there is any other way to achieve the same result? I appreciate if you could give me an idea about how to create such a module.
I really appreciate any and all input.
You can create a module and add a hook on node form using : hook_form_alter or hook_form_FORM_ID_alter
Using this kind of hook, you can easily modify node form and hide or make read only specific fields, based on whatever you want (user role, field value...)
There are also the hook_node_view_alter() hook and hook_entity_view_alter() hooks that allow you to modify the render array for a node before it is rendered. There you can set field arrays to have '#access' = FALSE so they are hidden, or '#access' = TRUE to show them.
I'm using this to hide some fields if the date in another field of the node has a time in the past (it's a "subscription expires" field). So I didn't need to change the edit form, just the field display.