I have a custom block type that only has one field: an entity reference to my news content type. I am trying to display two specific fields from the news content type but can't figure it out.  This entity reference field has a machine name of field_featured_news  I have created a file with the filename block--block-content-testnews.html.twig  In this file, I can use {{ content }} and it will render the full entity (based on the settings in Manage Display.   However, I can't access the image field that is within the news content type. The field's machine name is called field_featured_news_image.  I have tried adding the following to no avail:  {{ content.field_featured_news_image }} {{ content.field_featured_news_image.0 }} {{ content.field_featured_news_image.entity.uri.value }}  and many others.  Only {{ content }} will display anything but it's the entire news node.
123090
In Drupal 8, I have a content type, that has an "entity_reference" field and I wish to access the referenced node's fields in twig template. the kint() output for the field is:   In this list I can't find the referenced node's field values. How can I (if at all possible) load the node or node fields/values in twig?  Best,  Alari
2001
I'm trying to figure how I can get all the values inside an entity reference field  As shown in this image, I have an entity field called Target Participants(field_program_participants) with multiple values.    I have tried to output the values using node.field_program_participants.entity.label, but it only outputs one value.     How can I output all the values inside the field
88020
I have a content type that uses many cck fields, and I would like to theme the content type by grouping certain fields in "blocks" (not Drupal blocks but div blocks), preferably div tags, so that the fields aren't just displayed one after the other. I can edit the css of individual fields, but if I want a field to be in a div on the top right hand corner of my node types page, and then another group of fields to be along side it, and then another group of fields to fall underneath all of the other fields, that css could get messy and interfere with my themes main css. I'm not sure what to put in my template file, since all the fields just fall under "content."   I'm using Drupal 6, and a little new with php, but can do basic "print" and "if" conditions. Any help would be greatly appreciated! Thanks in advance!
56661
There is a lot about theming custom blocks, but what about blocks created by views?  My views block has id: block-views-posts-listing-block,  I try many ways for naming template file, ex: block--block--views-posts-listing-block.tpl.php, but I can't find correct file name.
79469
I have a custom entity that fieldable. I need to add a field to it, and I want to do it through the UI. The entity was created in a custom module, which I can modify. How can I make the entity fieldable? /**  * Defines the Quiz entity.  *  * @ingroup qwizard  *  * @ContentEntityType(  *   id = &quot;qwiz&quot;,  *   label = @Translation(&quot;Quiz&quot;),  *   bundle_label = @Translation(&quot;Quiz type&quot;),  *   handlers = {  *     &quot;storage&quot; = &quot;Drupal\qwizard\QwizStorage&quot;,  *     &quot;view_builder&quot; = &quot;Drupal\Core\Entity\EntityViewBuilder&quot;,  *     &quot;list_builder&quot; = &quot;Drupal\qwizard\QwizListBuilder&quot;,  *     &quot;views_data&quot; = &quot;Drupal\qwizard\Entity\QwizViewsData&quot;,  *  *     &quot;form&quot; = {  *       &quot;default&quot; = &quot;Drupal\qwizard\Form\QwizForm&quot;,  *       &quot;add&quot; = &quot;Drupal\qwizard\Form\QwizForm&quot;,  *       &quot;edit&quot; = &quot;Drupal\qwizard\Form\QwizForm&quot;,  *       &quot;delete&quot; = &quot;Drupal\qwizard\Form\QwizDeleteForm&quot;,  *     },  *     &quot;access&quot; = &quot;Drupal\qwizard\QwizAccessControlHandler&quot;,  *     &quot;route_provider&quot; = {  *       &quot;html&quot; = &quot;Drupal\qwizard\QwizHtmlRouteProvider&quot;,  *     },  *   },  *   base_table = &quot;qwiz&quot;,  *   revision_table = &quot;qwiz_revision&quot;,  *   revision_data_table = &quot;qwiz_field_revision&quot;,  *   admin_permission = &quot;administer quiz entities&quot;,  *   entity_keys = {  *     &quot;id&quot; = &quot;id&quot;,  *     &quot;revision&quot; = &quot;vid&quot;,  *     &quot;bundle&quot; = &quot;type&quot;,  *     &quot;label&quot; = &quot;name&quot;,  *     &quot;uuid&quot; = &quot;uuid&quot;,  *     &quot;uid&quot; = &quot;user_id&quot;,  *     &quot;langcode&quot; = &quot;langcode&quot;,  *     &quot;status&quot; = &quot;status&quot;,  *   },  *   links = {  *     &quot;canonical&quot; = &quot;/admin/structure/qwizard/qwiz/{qwiz}&quot;,  *     &quot;add-page&quot; = &quot;/admin/structure/qwizard/qwiz/add&quot;,  *     &quot;add-form&quot; = &quot;/admin/structure/qwizard/qwiz/add/{qwiz_type}&quot;,  *     &quot;edit-form&quot; = &quot;/admin/structure/qwizard/qwiz/{qwiz}/edit&quot;,  *     &quot;delete-form&quot; = &quot;/admin/structure/qwizard/qwiz/{qwiz}/delete&quot;,  *     &quot;version-history&quot; = &quot;/admin/structure/qwizard/qwiz/{qwiz}/revisions&quot;,  *     &quot;revision&quot; = &quot;/admin/structure/qwizard/qwiz/{qwiz}/revisions/{qwiz_revision}/view&quot;,  *     &quot;revision_revert&quot; = &quot;/admin/structure/qwizard/qwiz/{qwiz}/revisions/{qwiz_revision}/revert&quot;,  *     &quot;revision_delete&quot; = &quot;/admin/structure/qwizard/qwiz/{qwiz}/revisions/{qwiz_revision}/delete&quot;,  *     &quot;collection&quot; = &quot;/admin/structure/qwizard/qwiz&quot;,  *   },  *   bundle_entity_type = &quot;qwiz_type&quot;,  *   field_ui_base_route = &quot;entity.qwiz_type.edit_form&quot;  * )  */
95128
Example set up:  Content type news with fields   Body (translatable) date (another date field beside node published date - translatable) type of news (list field - not translatable, the news should be of the same type in every language)   View with filters:   Published: yes Content type: news Content language: currently activated interface language field "type of news" -> exposed to the user   Default language in the project is German.  When I go to the view in German and choose a type of news in the exposed filter there is no problem - the expected news are listed. The problem appears when I enter the page in English and I choose a type of news -> no results are found although the same nodes are translated into English.  I found out that this is due to the fact that the "type of news" values in the fields table are saved with the language id of the original node which is 'de' but the full view query expects the field value to have a language code 'en' (like the currently activated language has).  See this query and especially the INNER JOIN:   SELECT node__field_date.field_date_value AS node__field_date_field_date_value, node_field_data.nid AS nid, node_field_data.langcode AS node_field_data_langcode FROM {node_field_data} node_field_data INNER JOIN {node__field_news_typ} node__field_news_typ ON node_field_data.nid = node__field_news_typ.entity_id AND (node__field_news_typ.deleted = '0' AND node__field_news_typ.langcode = node_field_data.langcode) LEFT JOIN {node__field_date} node__field_date ON node_field_data.nid = node__field_date.entity_id AND (node__field_date.deleted = '0' AND node__field_date.langcode = node_field_data.langcode) WHERE (( (node__field_news_typ.field_news_typ_value = 'press') )AND(( (node_field_data.langcode IN  ('en')) AND (node_field_data.status = '1') AND (node_field_data.type IN  ('news')) ))) ORDER BY node__field_date_field_date_value DESC LIMIT 10 OFFSET 0   You may see that the inner join expects the langcode field in node__field_news_typ to be the same value as node_field_data.langcode which is 'en' when I enter the view in English. But looking into the table of node__field_news_typ I do not find one entry with 'en' as the field is not set to be translatable and all the nodes are originally written in German.  Maybe I did not get some basics of the multilanguage architecture in Drupal 8 but I find it a little bit strange that fields which are not translatable filter out nodes in views where a filter is set to "current active language". Is there not UNDEFINED_LANGUAGE ('und') anymore? Why do fields get a fix languagecode when they are not translatable? How can I avoid this behavior?   It seems to me that there is no other way as setting the field to translatable although I want to assure that translated nodes have the same value?!
86495
This is one of those times when I tried to add something and realized that I've got it applied to all displays. This time it was a vocabulary filter, so I clicked cancel and it didn't register so I clicked back to site.  After that I tried to edit and it returned     The website encountered an unexpected error. Please try again later.   The log shows this:     Exception: No entity type for field vid on view VIEW in   Drupal\views\Plugin\views\HandlerBase->getEntityType() (line 712 of   /PATH/core/modules/views/src/Plugin/views/HandlerBase.php).   I checked the active config and couldn't find anything with a vid. Clearing cache and reimporting the view config didn't fix it. So, is there a way?
6971
I have a view and added the title as a field. For example: How do I print the title?  In Drupal 7 it was as simple as views-view-fields--[viewname].tpl.php &lt;?php print $fields[&quot;title&quot;]-&gt;content; ?&gt;   How do we do this in Drupal 8? I have created views-view-fields--[viewname].html.twig I thought it might be {{ fields.title }} but I get the classic error message like so:  The website encountered an unexpected error. Please try again later.  I then tried {{ field.title }}, {{ title }} and {{ content.title }} but nothing prints.
76549
For example  Drupal\Core\Entity\Entity::id() returns $this-&gt;id(or NULL) Drupal\Core\Entity\ContentEntityBase::id() returns $this-&gt;id-&gt;value Drupal\Core\Entity\ContentEntityBase::uuid() returns $this-&gt;get('uuid')-&gt;value Drupal\node\Entity\Node::id() returns $this-&gt;get('nid')-&gt;value  Also in some methods there are setValue() and getValue() utilised but sometimes there are just $this-&gt;field-&gt;value. So what is the reason for this inconsistent behavior? From my understanding all the &quot;fields&quot; are TypedData fields hence the setValue() and getValue() methods should be used instead of directly access $this-&gt;field-&gt;value. Besides it's strange because $value is private.
74370
I created a custom content type with some text fields. In the view settings of that content type I defined both to appear and as well their titles (names of the fields) to be displayed above the content of the fields respectively.  But how can I remove the trailing colon of the titles? Is there a way of modifying the way field names are display just for certain content types? I do not want this altered site wide (e.g. for all fields of all content types).  PS: I'm already using the "views" module to define a special layout for this custom content type. Probably there is a way to carry out these changes with the help of the "views" module and a custom layout template?  /edit/ I did not create a view (as with the "views" module) to display that content but used Drupal's own content type view configuration (maybe called "display"). I'm working with a localized Drupal and retranslating the different words.  Remark: Using Drupal 7.10 with Views 7.x-3.0-rc3
84662
I want to clone a node type and add a few fields in it. I think the simplest will be to duplicate it and start working on it.  It seems there is no official way to clone a content type in Drupal 7. Features may allow it but there is no written procedure as to how it could be done.  I've even tried  module.  What'll be best way to clone any content type in Drupal 7?
117690
I'm really struggling to add a taxonomy_term as an entity reference to a custom entity I've created programmatically.  Here is my configuration based on BaseFieldDefinition (the name of the vocabulary is "specialite":  $fields['speciality_field'] = BaseFieldDefinition::create('entity_reference')   -&gt;setLabel(t('speciality'))   -&gt;setRevisionable(TRUE)   -&gt;setSetting('target_type', 'taxonomy_term')   &gt;setSetting('handler_settings', ['target_bundles' =&gt; ['specialite' =&gt; 'specialite']])   -&gt;setSetting('handler', 'default')   -&gt;setTranslatable(TRUE)   -&gt;setDisplayOptions('view', array(     'label' =&gt; 'hidden',     'type' =&gt; 'author',     'weight' =&gt; 0,   ))   -&gt;setDisplayOptions('form', array(     'type' =&gt; 'entity_reference_autocomplete',     'weight' =&gt; 5,     'settings' =&gt; array(       'match_operator' =&gt; 'CONTAINS',       'size' =&gt; '10',       'autocomplete_type' =&gt; 'tags',       'placeholder' =&gt; '',     ),   ))   -&gt;setDisplayConfigurable('form', TRUE)   -&gt;setDisplayConfigurable('view', TRUE);   This piece of code doesn't work, would you please help to find what I am missing, or redirect me to a good documentation explaining different values for handler_settings  Thank you so much.
117080
I have two content types called Basic Page and Contact Info.    There are around 5 nodes from Contact Info with some contact info (phone/fax/email/IM) in the body field.  In Basic Page content type there's an Entity Reference field that refers to Contact Info. So that for each page there would be a main contact person. When someone create a Basic Page node they can pick a Contact Info node from the dropdown (out of the 5 Contact Info nodes).      Basic Page -> Contact Info (Basic Page content type refers to Contact   Info content type)   Then I created a block view (added to the sidebar of Basic pages) which displays the contact info associated with that node.   Added a Relationship in the view (Entity Reference: Referenced Entity)  Right now it's displaying all 5 contact info nodes, not just the one associated with that particular basic page node. I tried to tweak the Contextual filter and relationships but couldn't get it to work.  I have a feeling that the solution lies in the php code that goes in Provide default value -> php code section.  Any help appreciated. Thanks
106795
I created an entity in a module, using code. I generated skeletons with drupal console generate:entity:content (without bundles), and then added a datetime field to my TestFieldEntityItem.php, in baseFieldDefinitions().  $fields['test_date'] = BaseFieldDefinition::create('datetime')   -&gt;setLabel(t('Test date'))   -&gt;setDescription(t('Test.'))   -&gt;setRevisionable(TRUE)   -&gt;setSettings([     'datetime_type' =&gt; 'date'   ])   -&gt;setDefaultValue('')   -&gt;setDisplayOptions('view', [     'label' =&gt; 'above',     'type' =&gt; 'datetime_default',     'settings' =&gt; [       'format_type' =&gt; 'medium',     ],     'weight' =&gt; 14,   ])   -&gt;setDisplayOptions('form', [     'type' =&gt; 'datetime_default',     'weight' =&gt; 14,   ])   -&gt;setDisplayConfigurable('form', TRUE)   -&gt;setDisplayConfigurable('view', TRUE);   I installed my module, cleared the cache, reinstalled calendar and calendar_datetime modules, but when I try to add a view from a template, like the calendar module suggests, I can't see any template matching my datetime field.  If I create a datetime field on this entity through the UI, it appears in view templates. What am I missing?  Inspecting the calendar code, I found the function that search datetime fields, in . This function finds my field, but the field_info does not match isDateField() because of the argument property.  isDateField() wants 'datetime' as argument ID.  protected function isDateField($field_info) {   if (!empty($field_info['field']['id']) &amp;&amp; $field_info['field']['id'] == 'field') {     if (!empty($field_info['argument']['id']) &amp;&amp; $field_info['argument']['id'] == 'date') {       return TRUE;     }   }   return FALSE; }   My field_info argument is 'string'.  array (size=7)   'title' =&gt; ...   'help' =&gt; ...   'field' =&gt;        'id' =&gt; string 'field' (length=5)   'argument' =&gt;        'id' =&gt; string 'string' (length=6)   'filter' =&gt;        'id' =&gt; string 'string' (length=6)   'sort' =&gt;        'id' =&gt; string 'standard' (length=8)   'entity field' =&gt; string 'test_date' (length=4)   So thanks to @4k4 answer, I tried to do the same as the working date field, and I created my own EntityViewsData (I tried hook_views_data_alter() first but the field was not present in input data)  namespace Drupal\kabukis_tests\Entity; use Drupal\views\EntityViewsData;  class TestEntityViewsData extends EntityViewsData {   public function getViewsData() {     $additionalData = [       'test_date' =&gt; [         'title' =&gt; new TranslatableMarkup('Birth date'),         'help' =&gt; new TranslatableMarkup('Birth date'),         'field' =&gt; [ 'id' =&gt; 'field' ],         'argument' =&gt; [ 'id' =&gt; 'date' ],         'filter' =&gt; [ 'id' =&gt; 'date' ],         'sort' =&gt; [ 'id' =&gt; 'date' ],         'entity field' =&gt; 'test_date',       ]     ];     $data['test_field_entity_field_data'] = array_merge($data['test_field_entity_field_data'], $additionalData);     return $data;   } }   Now, the field appears in views template list ! However, the generated view is not working, I get the following error :     \Drupal\calendar\Plugin\views\style\CalendarStyle: A calendar date argument is required when using the calendar style, but it is missing or is not using the default date.
13689
I've asked this question towards a developer for Minecraft and I thought I'd ask here too since they might not see the question.  How do I select all but two types of entities in Minecraft?  For example, something like: /say @e[type=![Player,Item],r=50] (to clarify I also tried type=Item,Player, type=Item,type=Player etc)  Should select any entity that does not match players or items, so things like Creepers, Ghasts, XPOrbs, PrimedTNT and so on within a radius of 50 blocks and print them to the chat.  Instead it ignores one of the flags, and works with the other instead.
117109
I created a view block, whose machine name is "news."    How do I display it using module_invoke() and the machine name of the view?
66126
I have a custom object "Reporting__c".  This custom object is linked to MyContracts__c, which is a child of Opportunity.  I need to display a field from Opportunity on my Reporting__c object and I want to use a formula.  I tried:  Formula(Text) = MyContracts__r.Opportunity.CustomField   But this does not work. Isn't this possible?  Tia.