drupal-8

Custom Drupal-8 module doesn't appear

一个人想着一个人 提交于 2019-12-13 02:33:14
问题 I have successfully installed my own module on Drupal8 site. I tried to access it by entering path specified in routing.yml file but I'm getting 'Page not Found' error. I'm almost sure that my module is written correctly(I was following a tutorial where the same module where accessed successfully). What could cause my issue and how can I solve it? here are my module files: 1)kalvis.info.yml name: 'Kalvis' description: 'My module' type: 'module' core: 8.x 2)kalvis.routing.yml kalvis.content:

How to create a query in Drupal 8

跟風遠走 提交于 2019-12-12 07:50:57
问题 I am used to using db_select in drupal 7 but now it's deprecated in drupal 8 So, If I need to create a query to list all users from users_field_data table, What should I do? Do I still use db_select or db_query even though they are deprecated functions? Or create a new controller to extend from " Select class " and make my query? 回答1: Depends on what you are trying to achieve. Using the storage object If you want to make a simple query about the users then you should use the loadByProperties

How to fix an error message issue of security update available for my version of Drupal?

冷暖自知 提交于 2019-12-12 04:37:46
问题 I can see this error message on Drupal admin panel. There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately! See the available updates page for more information and to install your missing updates. There are security updates available for one or more of your modules or themes. To ensure the security of your server, you should update immediately! See the available updates page for more information and to install your

Retrieve a taxonomy term in the buildrow function of a drupal 8 custom entity

六月ゝ 毕业季﹏ 提交于 2019-12-12 04:02:53
问题 I have built a custom entity that works well. One of my fields is a taxonomy but I can not retrieve the name of the term in the buildRow(EntityInterface $entity) function which displays my records. For a simple string field I do: $row['foo'] = $entity->foo->value; How to do a taxonomy term that is an entity_reference: $row['bar'] = $entity->BAR_TERM_NAME; Thank you for your help. 回答1: To work as requested you need 3 things: Implements an entity_reference field in your custom Entity. Add a

Bootstrap “Tour” bug when I start it

二次信任 提交于 2019-12-11 18:55:11
问题 I have a site built with Drupal 8 and Bootstrap 3 . When a user visited the site, Tour starts automatically. When Tour is finished, a cookie is placed in the browser of the visitor so that Tour will not start when the user reloads the page. The Site: https://www.s1biose.com My problem : I created a button on the left menu Commencer la visite , so that users access the Tour manually. Every time I restart the Tour manually, a bug will appear from time to time. It must be restarted several times

BadRequestHttpException POST REST Resource

淺唱寂寞╮ 提交于 2019-12-11 18:02:29
问题 I am attempting to create a custom REST resource. My module is as follows: /example.info.yml name: Example description: '' type: module core: 8.x version: DEV dependencies: - serialization - basic_auth - rest /src/Plugin/rest/resource/BasicGetResource.php namespace Drupal\Example\Plugin\rest\resource; use Drupal\rest\Plugin\ResourceBase; use Drupal\rest\ResourceResponse; /** * Provides an Example Resource * * @RestResource( * id = "example_resource", * label = @Translation("Example Resource")

How to Subscribe to DrupalCommerce 2X Events for every new Order, Product etc is created

别等时光非礼了梦想. 提交于 2019-12-11 14:24:03
问题 I need to be able to write a Plugin that gets the orders, product, etc., whenever a new Order, Product is created in DrupalCommerce 2X. but I can't seem to figure out how Commerce wants me to do it. I don't see any *events files that would give me the data. It looks like Commerce wants me to create a separate Event Flow plugin that would add the step I want, but I can't seem to find documentation about implementing my own Event Flow. Can you guide me to the right path of running my code when

Custom blocks not working in Drupal 8

偶尔善良 提交于 2019-12-11 11:46:45
问题 I'm building a module with custom block in Drupal 8 beta 9. When I create a block in my module I'm placing it in src\Plugin\Block directory. The block show in 'Block structure' list, but when I press link to add it, nothing happens. I reviewed my code 10 times, tried to put my files into core module's directories (only for test obviously), tried to put some core block files to my directory, to copy-paste code. None of this works. Here is a code of my block file: <?php /** * @file * Contains

Filter Entity Reference View with dynamic arguments from Reference Field

人走茶凉 提交于 2019-12-11 08:52:58
问题 I need to filter an "Entity Reference View" autocomplete widget by passing arguments from a "Reference Field" in my content type. I researched on this and found that PHP Code type Contextual Filter is the most suggested way to achieving this but as PHP Code has now been removed from Drupal 8 Core, what are the alternatives to this common use case? (an earlier suggestion to use PHP Code: Drupal 7: how to filter view content (with entity reference field) based on current page content) While

Drupal 8: How to create multi lingual menu item from .links.menu.yml

匆匆过客 提交于 2019-12-11 06:20:01
问题 So, at many places, i.e. here: https://www.drupal.org/docs/8/api/menu-api/providing-module-defined-menu-links It's explained how to add menu item to some existing menu from module_name.links.menu.yml of your module. Problem is that menu items can be translatable (from back-end), but I didn't find anywhere how to add menu items in multiple languages? Is that possible at all? So, I have one menu, I want to add one menu item, but on each language that menu item should have different title and