Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Nodes, comments, taxonomy terms, and users, in the terminology used since Drupal 7, are generally called "entities."
1
vote
How can I get the current widgets name of a node?
From the docs of field_info_widget_types() :
Returns information about field widgets from hook_field_widget_info().
Parameters:
$widget_type: (optional) A widget type name. If omitted, all widget typ …
1
vote
Accepted
How to change the path of views content?
may be you have used absolute url(starting from http://localhost:8082/content/..) instead of relative url(starting directly from content/..)
11
votes
How can I get bundle of an entity from type and id?
Use entity_load to load the entity as mentioned by @Nikhil.
Then use entity_extract_ids, to extract the bundle. Example:
$entity = entity_load('node', array('7'));
list(, , $bundle) = entity_extrac …
2
votes
Accepted
How to get a field with a relationship in a view
Note: I've written this generically; it should work for any type of entities (e.g. Nodes, Users, Files, Taxonomy, etc.) …
3
votes
Accepted
Print $entity info
You use the -> operator for accessing the data attributes in a PHP object.
Use $entity->id to access the id of the entity.
If you want to access a value of the field (which is an array), you do it l …
2
votes
How to handle separated stock for a product bundle?
I am the author and maintainer of the Commerce Product Kit module which is close to your requirement.
It provides a "field formatter" for the "product reference" or an
"entity reference" fields …
1
vote
How to add a display format for the field
You will require to write your own custom field formatter to achieve that. There are detailed docs at : https://www.drupal.org/docs/8/creating-custom-modules/create-a-custom-field-formatter
File /mod …
5
votes
Accepted
How do I have a dropdown select list for an entity reference?
Yes, you can. Drupal 8 does it out of the box as D7. The only difference is you can now choose the widget for any field in the Manage form display tab of a entity type.
E.g. Try changing the widget o …
2
votes
How to add a CSS class to fields in Drupal 7?
Classes can be specified at the Manage display settings for content types, users and other entities.
OR
The Field Formatter CSS Class module. …
29
votes
Accepted
How to programmatically remove a field from a node?
field_delete_field($field_name) will mark the $field_name for deletion on next cron run.
You could use field_purge_batch to do the deletion, if you don't want to do it on cron run.
EDIT: field_delet …
4
votes
Accepted
Hide Fields Based on Role
Sounds like the function of Field Permissions module.
The Field Permissions module allows site administrators to set field-level permissions to edit, view and create fields on any entity.
0
votes
Using Entity metadata wrappers to change field value under hook_node_insert()
The method you are using the save the field isn't ideal.
For setting the field values you should use the set() function provided by the EntityMetadataWrapper class.
function mymodule_node_insert($nod …
1
vote
Turn text or link field in image
The best way to implement this is to implement a custom display formatter for the link field. You can either do it directly in a custom module by implementing hook_field_formatter_info.
Or without tr …
2
votes
Can't import configs on server due to some entities
Find out what changed in the entities. The change should most probably be in the field settings for one or more fields in the entity types listed in the messages. … Everything would be easy if there are a limited amount of entities with values in the conflicting fields and that the data could be handled manually by deleting the fields. …
7
votes
Accepted
How to implement a duration field?
Posting my comment as answer - Check for HMS (Hours Minutes Seconds) Field module.
Displays a integer formatted as Hours, Minutes or Seconds.
The field stores values as integer. Both input and o …