I want some custom Dexterity types can be explicitly edited for their short name (ID, that will be part of the URL) field. If the short name field is left blank, then it will be calculated from the (required) title field value by the enabled plone.app.content.interfacess.INameFromTitle behavior.
By default, I see no short name field when adding/editing the type. Only via object_rename from action menu I can set its short name. What is the best practice for this task?
The id field is not part of the Dexterity schema, at all.
You'd have to create an additional behaviour that adds it.
Related
I am looking to hide/show some fields depending upon user selection on another field. So a user can select among four wheeler/two wheeler. If user selects four wheeler from a dropdown he is shown different set of fields and for two wheeler different set of fields . As there are many common fields I am looking to use same content type for both content type
What I have tried so far is
Theme_name_form_alter hook in theme_name.theme file
As well as hook_form_FORM_ID_alter
None seems to be working for me
while Conditional Field module still is in development on Drupal 8 So
Field Formatter Condition Module could be a good choice.
Simple conditions and actions
Hide source field when target field is empty. Hide source field when
target field is not empty. Hide source field when the current user has
specific roles. Hide source field on specific pages. Hide source field
when target field contains a specific string. Hide source field when
target field doesn't contain a specific string. Hide link field if
title is empty. Hide date field if smaller/greater then today/custom
date. Hide if content from author Hide if checkbox is checked (in
current dev version)
Module conditional fields is still dev for Drupal 8 but should work:
https://www.drupal.org/project/conditional_fields
And in case "Conditional fields" is not working for you maybe "Paragraphs" can jump in as replacement. It's stable at least.
https://www.drupal.org/project/paragraphs
Not exactly what you were asking for, but can do the job.
I am new in Drupal and other web concepts. I have installed Drupal 8.1.1 and everything is OK. It has a default content type called Article. I add another content type called Project. in Manage Fields section I click on Add Field button, then from the box Re-use an existing field, I choose Entity reference: field_tags option. The problem is in Edit page for this added field, I see another view for tags section.
Here the Project content type:
And here is the Article content type:
As you see the default value sections is different. So what is the problem and how can I fix that?
Thanks
This isn't necessarily a problem, unless you need to enter multiple default values for your article content type.
The default value form for the field instance is dependent on the cardinality, or number of values the field can contain.
If you wish to change the cardinality, you will need to do so when editing the field base, and it cannot be changed once values have been added to the field on your content types. You can do this when adding a field, or by editing the field when there is no data entered across your content types.
If you are looking at the Edit view when creating one of your content types and wish to change the way the field's form looks, you may do so by editing the content type's Form Display setting for that field, and change the field display type there.
How can I define default custom fields list in wordpress?
I want to give users ability to choose custom fields from list when they create or edit post in admin. On that coustom fields I will base design and make different styles when users choose "youtube" or "image". It's impossible to find any solution for that simple problem in web.
WordPress takes existing custom fields and presents them in a select box. So, once you've created a custom field once on one page it will be available on all pages in the WP Admin. Just click "Enter New" about the Custom Field select box and it will allow you to enter in a new meta key.
More Technical
Custom Fields are stored in your Metadata database table, whereas the custom field name is the meta_key and the custom field value is the meta_value.
When an edit page loads it take a grouping of all custom fields (minus fields that are used for internal use) and presents them in the select drop down.
Retrieving
Retrieving a custom field would be as follows:
$custom_field = get_post_meta($post->ID,"CUSTOM FIELD NAME",true);
Predefined Custom Fields
WordPress offers a popular plugin Advanced Custom Fields that allows you to create different types of custom fields with preset values. This helps content editors to choose the appropriate value attached with the appropriate custom field.
I have a cck field which is a user lookup. By default it looks at the "name". In my site we set the name to be the same as the email address and store the first and last name in a content profile.
When using the cck field the email adress in the name field is being shown. I wish to pull the content from the content profile instead. How would I override the select list (I will need to do this for all cck filed user lookups on the site).
I assume you're using the autocomplete function on a user reference field.
In userreference.module you will find the function userreference_menu, an implementation of hook_menu. There you see that a request to example.com/userreference/autocomplete (that's what the autocomeplete field does) calls the userreference_autocomplete function (a 'menu callback'). Now, what you need to do, is:
Create a custom module (see the documentation on drupal.org)
Create a new autocomplete menu callback (you can use the code from userreference_autocomplete and change it the way you want)
Change the menu item for userreference/autocomplete by implementing hook_menu_alter so it will call the function you created in step 2
Enable your module
I have a content type named Properties, users can create the content types
I have file cck field in the content type (properties), now I want to add the attachments to the or edit the attachments field only in a block or panel for the particular property.
Not showing all the fields when user try to edit the content type.
I have heard that this is possible in panels using contexts.
Thanks in advance
Not sure I understand what you want here, but it sounds like you want to change the visibility/editability of fields based on role and display.
To change the visibility and/or editibility based on role, use something like this
http://drupal.org/project/field_permissions
To change it based on display, use the "display fields" tab on the content type edit form.
I think this is what you are looking for
http://drupal.org/project/editablefields