drupal-8

Field Collection RESTful API rendered in HTML

孤人 提交于 2019-12-11 06:03:57
问题 I'm not sure this is a bug or what. But when I create API view page and add field (which is field collection), it rendered HTML instead of 'neat' JSON. For example it should be look like : field_collection_name: [ { "title": "Big Title" "field_a": "content" }, { "title": "Big Title 2" "field_a": "content 2" }, { "title": "Big Title 3" "field_a": "content 3" } ] Instead, the JSON in api view render like this: field_collection_name: <div class="field--name-title">Big Title</div><div class=

Can Angular 2 parse links received from external CMS to be resolved as internal

独自空忆成欢 提交于 2019-12-11 02:57:44
问题 We are working on a decoupled project with Drupal as our backend and Angular as our front-end. Everything is nearing completion but certain (dynamic, as in created in Drupal) pages require links to different pages of the angular app. For example: An editor creates an FAQ question in Drupal with an answer containing a link to the Pricing page of the angular app. (Q: How much does this service cost? A: Check out our [pricing] page) User on frontend opens FAQ page Angular loads our FAQ page

Does Aegir 3+ support both D7 and D8 deployments

爷,独闯天下 提交于 2019-12-11 01:52:36
问题 We have a current installation of Aegir, old enough to not support D8 installs. Looking to cut over at some point. So that begs the question: Does Aegir 3+ support both Drupal 7 and Drupal 8 installations? To where we could deploy a D7 test site to a D7 server and likewise with 8 from the same Aegir interface? Thanks in advance! 回答1: Does Aegir 3+ support both Drupal 7 and Drupal 8 installations? Yes. To where we could deploy a D7 test site to a D7 server and likewise with 8 from the same

Drupal 8: How do I customize a form widget to show an entity field value instead of the entity title?

回眸只為那壹抹淺笑 提交于 2019-12-10 18:45:29
问题 I'm taking my first steps in understanding how Drupal 8 works under the hood by developing a custom form widget module. My goal is to show a referenced node's image field value, instead of its node title in a radio button list (available in core). This will allow website admins to select a picture instead of text when choosing a background image for a node. Here's how my form looks without a custom work, using Drupal 8's built-in "Check boxes/radio buttons" widget: Here's a Photoshop mockup

Drupal 8 include part template

谁说胖子不能爱 提交于 2019-12-10 17:21:38
问题 I'm trying to use Drupal 8, with an own theme, due big structure differences for my requirements I have a page--front.twig.html and a page.twig.html, I would like to create template parts as used in phrozn oder in a normal Symfony2 project, for example a footer.html.twig and a header.html.twig. These templates are saved under a subdirectory /parts/ But wenn I call this templates as normal I just receive a string with the name of the template. For example: {# in page.html.twig or page--front

Get Taxonomy Term ID by Node in Drupal 8

强颜欢笑 提交于 2019-12-10 15:54:16
问题 I'm trying to get Taxonomy data by particular node. How can I get Taxonomy Term Id by using Node object ? Drupal ver. 8.3.6 回答1: If you want to get Taxonomy Term data you can use this code: $node->get('field_yourfield')->referencedEntities(); Hope it will be useful for you. PS: If you need just Term's id you can use this: $node->get('field_yourfield')->getValue(); You will get something like this: [0 => ['target_id' => 23], 1 => ['target_id'] => 25] In example my field has 2 referenced

Where Drush 9 aliases file should be located in Drupal 8?

柔情痞子 提交于 2019-12-10 13:29:24
问题 I have tried some ways to create an alias for my local Drupal project, I'm referring to : https://www.drupal.org/node/1401522 https://www.drupal.org/project/drush/issues/831272 https://www.drupal.org/project/drush/issues/786766 I can connect by running this command : drush --root=C:/wamp64/www/executive-coatings --uri=http://localhost:81/executive-coatings status Output : Drupal version : 8.6.13 Site URI : http://localhost:81/executive-coatings DB driver : mysql DB hostname : localhost DB

get $tempstore inside a twig file drupal 8

时光怂恿深爱的人放手 提交于 2019-12-08 04:50:37
问题 i'm creating a module my_module, I want to tempstore a variable and get it inside a twig file. here my controller: $tempstore = \Drupal::service('user.private_tempstore')->get('mymodule'); $tempstore->set('response', $response); twig: {{ ?? like response }} 回答1: First register your theme in module file function hook_theme($existing, $type, $theme, $path) { return [ 'my_template' => [ 'variables' => ['test_var' => NULL], ], ]; } Second call this theme from controller and pass the variable

Drupal 8 fetch content and serve without header/footer

纵饮孤独 提交于 2019-12-07 20:57:44
问题 I'm working on a Drupal 8 site where I have a custom module/block that fetches content from another server and injects it to a div. When a user clicks on a link (like read more) from the injected content, I need to serve the content (full html page) (that gets fetched from the server) without my template's header and footer. My question is how can I serve a page without my template's header and footer? Thanks you. 回答1: This is an old question but it's coming up in searches and I wanted to

Drupal 8's SMTP Authentication module could not connect to SMTP Host [closed]

时光怂恿深爱的人放手 提交于 2019-12-07 08:49:24
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . I've found other threads online that deal with this specific problem, but none have helped. I have two questions: One with Drupal 8, the other with telnet. Background: A client is using a third party company to handle all of their emails. I manage a Drupal 8 site for them that sends some emails with PHP's mail() function. Unfortunately, those emails are being tagged as spam and being sent to their spam folders.