drupal-8

Drupal 8 - creating an accordion field

纵然是瞬间 提交于 2019-12-30 11:41:29
问题 In Drupal 8 -- I want to modify the basic-page content type to be able to support an "accordion field type" I've seen the list field type - that can have unlimited fields -- but I am looking for a solution that can feature -- header/body - type features. 回答1: There is no module to handle this for you, the solution is to create unlimited Entity Reference in your content type, it must have two fields, Title and Body as you want, and to convert it to accordions you should customize new entity

Why is my Drupal 8 module show Page not found?

戏子无情 提交于 2019-12-25 16:00:52
问题 I'm following the Modules, Routes and Controllers tutorial. However, I kept getting "Page not found" regardless of "Clear all cache". dino_roar.info.yml file: name: Dino ROAR type: module description: "ROAR at you" package: Custom core: 8.x dino_roar.routing.yml dino_says: path: /the/dino/says/ defaults: _controller: Drupal\dino_roar\Controller\RoarController::roar requirements: _permission: 'access content' and src/Controller/RoarController.php file: <?php namespace Drupal\dino_roar

Is it possible to have multiple cache entries depending on the language in drupal 8?

ε祈祈猫儿з 提交于 2019-12-25 09:05:19
问题 I have a complex variable {{course_type.title[language] | nl2br}} in my custom block template. language is the current sites language but the content is only delivered in the language of the time, when the cache was build. I do have languages in my render array and it works for {% trans %} commands in the twig template: return array( '#theme' => 'block__vt_course_offer', '#data' => $courseData, '#cache' => [ 'contexts' => ['languages'], 'tags' => $cacheTags, ] ); Is there a way to get Drupal

Drupal 8.2.x text editor stripping-removing “div classes”

徘徊边缘 提交于 2019-12-25 08:00:48
问题 I have a problem with Druapl 8.2.1 text editor and CKeditor, system keeps stripping - removing classes from " And example of this: <div class="social clearfix"> </div> System renders: <div> </div> I can't configure the allowed elements, that was only possible in previous versions (config.allowedContent = true;) Any help would be greatly appreciated 回答1: Ok, well after breaking my head thinking and re thinking in all I have already done I just did what it was left to do. Since there is no way

Why are characters inserted in my PHP link?

早过忘川 提交于 2019-12-25 03:34:37
问题 I created a module, but the link is not correct. My site now shows : /store/2?0=/cgv The correct link should be : /store/2/cgv Why doesn't it work ? where is the error ? What should I change in the code below, to get the link ? <?php namespace Drupal\commerce_agree_cgv\Plugin\Commerce\CheckoutPane; use Drupal\Component\Serialization\Json; use Drupal\Core\Form\FormStateInterface; use Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase; use Drupal\commerce_checkout\Plugin

How to create a custom token for the Message module?

♀尐吖头ヾ 提交于 2019-12-25 00:43:07
问题 I have a site with Drupal, as well as the modules "Message" and "Token". I created a custom module based on the module "Message example". I created for entities, a display mode called message_activity_stream . I created a token to display the rendered entity of the nodes and it works. Now I want to create a custom token to display the rendered entity of the author of the message. How to create a custom token in my module, to display the rendered entity message_activity_stream of the user

Taxonomy list dependent on choice from another taxonomy list, drupal 8

别说谁变了你拦得住时间么 提交于 2019-12-24 21:21:06
问题 I have a taxonomy option list make where I choose say Toyota . I want the second taxonomy option list with the models of Toyota only (Eg. Corolla, hilux etc...). When I choose Benz the second list will then contains C-Class, ML, etc... I have created the entity vehicle from google examples on xampp localhost, windows 10. In my vehicle form I'm able to populate the first list. But the second appears empty. Here is my code. Please help: public function buildForm(array $form, FormStateInterface

Can't install drupal 8 commerce checkout module

人走茶凉 提交于 2019-12-24 12:20:03
问题 I'm trying to install drupal 8 commerce checkout module, but I'm getting the error: Unable to install Commerce Checkout due to unmet dependencies: core.entity_view_display.commerce_product_variation.default.summary (commerce_product.commerce_product_variation_type.default) I can't find the problem, what it could be and how to fix it? 回答1: It looks like we have a soft-dependency issue on Commerce Product. Please install Commerce Product first. This is an issue due to the default checkout

How to add javascript library in Drupal 8 theme?

纵然是瞬间 提交于 2019-12-24 11:16:18
问题 I'm attempting to include a custom javascript file to manipulate my menu's in the Drupal 8 theme I am building. I followed the instructions in the Drupal 8 themeing guide, including it in my .info.yml file: #js libraries libraries: - dcf/base and defining it in my .libraries.yml file: base: version: 1.x js: js/endscripts.js dependencies: - core/drupal - core/underscore - core/backbone - core/jquery and finally creating a .theme file with a hook implementation (I'm not really a PHP developer,

Using preprocess hook on specific node type in Drupal 8

依然范特西╮ 提交于 2019-12-23 18:01:36
问题 I've had success using preprocess page hooks such as: function mytheme_preprocess_page__node_front(&$variables) { ... } and function mytheme_preprocess_page__node_12(&$variables) { ... } which correlate with custom templates named page--front.html.twig and page--12.html.twig, respectively. I'm trying to implement the same hook and template pairing for a content type called Video. I understand that there is a difference in that my examples have been custom templates for specific pages while my