Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [plugins]

Use it for Drupal 8 plugins; for plugins implemented from the Views module use views, ctools for Chaos tool suite plugins.

0
votes
1answer
31 views

Get Plugin Definition methods using dependency injection

It is my first time defining a custom Plugin Type. I think that this might be a comming thing in Drupal but I was not able to find any documentation anywhere. I want to get Plugin definition methods ...
0
votes
1answer
21 views

migration process plugin not registering

My plugin aims to strip out html tags from titles being imported from xml Here is the error I'm receiving: FVFXF0ETHV2F:process k28002$ drush mim complinet_xml_to_node Drupal\Component\Plugin\...
1
vote
1answer
50 views

How do I add the ability to change font size in CKEditor?

I'm trying to install the CKEditor Font Size Module in my my editor. I installed the module via composer and then proceeded to copy the font/plugin.js file from the Font Plugin's page into libraries/ ...
0
votes
0answers
10 views

Entity Reference Custom Entity not visible

I made the following module with a custom entity in it. This is all working fine, but now i want to make a entity reference field in some content type to this custom entity. For this i made the ...
0
votes
1answer
31 views

Plugins before event subscribers

Not sure if there's a way out of this problem but... I have a custom log module which listens for events that could come from multiple sources. All it does is listen for an event, and if it occurs ...
0
votes
1answer
17 views

define a template file for a field item in my modules

I wish to register a template file for use with a filed item, but I can't wrap my head around it. here is what I am trying to achieve. In my field widget Formatter public function viewElements(...
0
votes
1answer
26 views

EntityReferenceSelection plugin ignored

I am trying to create a simple time tracking app and for this purpose, I need an entity reference field with some additional filtering of referenced entities (only active projects can be selected). I ...
0
votes
1answer
20 views

Load the value of an entity field type in another form

I have created a custom field and I wish to load the value dynamically in another form in relation to the specific node entity the value belongs to. I understand that to get the value I have to use/...
0
votes
0answers
75 views

How to fix “Cannot read property 'icons' of null” error?

First of all, I'd like to mention this answer is not related, I'm using Drupal 8.6.1. I'm trying to create a CKEditor plugin with a new button. In the /admin/config/content page I get the error but ...
0
votes
0answers
17 views

How to describe data for a custom views filter in the my_module.schema.yml file?

I encountered with a problem. For creating a custom views filter in my own module I should also describe it in the my_module.schema.yml file. Could you clarify me, how to do it? For instance, there ...
1
vote
1answer
52 views

Migration Custom Plugin Return Value

I have a migration and it is very simple. I have a CSV file of employee number and years of service. I have added the two fields to the users in the system and populate them when the users have been ...
0
votes
0answers
14 views

Way to sort on current page translation language in views (D8)

Is there a way to sort nodes on current node translation language in views (Drupal 8)? A bit like you would use 'Interface text language selected for page' under filter criteria. With sort criteria ...
0
votes
1answer
161 views

CKEditor oEmbed Plugin Shows up in config but not in actual Editor instance

The issue I'm having is very similar to this question, but the solutions here did not work for me. The steps I took: Downloaded the latest version of the oEmbed plugin from https://ckeditor.com/...
3
votes
0answers
94 views

How to set the correct RSS row plugin?

I need to add an image to the RSS feed. So I create a new row plugin for the RSS and it extends RssFields row plugin. /** * Renders an RSS item based on fields. * * @ViewsRow( * id = "...
1
vote
0answers
26 views

Why methods valueValidate and valueSubmit don't execute?

I'm trying to create a views filter containing an exposed form. The filter class is inherited from FilterPluginBase. In principle, the filter almost works, but I have run into a strange problem. I ...
1
vote
1answer
51 views

The pdf_thumbnail plugin does not exist

After I tried to update the database I got the following error: Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: [error] The "pdf_thumbnail" plugin does not exist. in ...
0
votes
0answers
36 views

how to change #disabled FALSE in formElement by JQuery

In my custom field I set the disabled attribute to TRUE, but I want to set it to TRUE when the value of another form field changes. Can I do it with Jquery? With the following instruction: $ (". ...
0
votes
1answer
46 views

How do I create a custom view filter for an existing field?

I ran into a problem with creating a custom view filter for an existing field for Drupal 8. I mean a filter not for fields like "nid", "title" and so on, but for fields, which were named CCK-fields ...
0
votes
2answers
81 views

Get the value of one field from another in the same form

I have a form with multiple fields. How can I get the value of field B from within the formElement method of my widget class for field A?
0
votes
0answers
34 views

add ajax behavior to a custom field

I have two custom fields Region and State. You can see the implementation of Region at this link: Region custom field I want to add an Ajax call to the field Region onchange event that gets a list ...
0
votes
1answer
26 views

Lost setting of the custom field when editing a page

I created a content type with my own custom field as described in Why do I get this error when I save my custom field? The insertion of an item with this content type works, but when I want to modify ...
0
votes
1answer
38 views

Why do I get this error when I save my custom field?

I created a custom field and this is its formElement() method. public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { ...
0
votes
1answer
21 views

formatting a select custom field

I created a custom field with the following definition: public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $...
0
votes
1answer
59 views

Validation plugin for a Boolean field

I want to contextually filter my View with a boolean field, for which the "On" value is "New," so using a URL like /view/url/new. I first tried basic validation, but that would only work if my URL ...
0
votes
2answers
46 views

How does data propagate from the formElement of a Widget to the properties of a FieldItem?

Here is my custom Widget: <?php namespace Drupal\scripture\Plugin\Field\FieldWidget; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\WidgetBase; use Drupal\Core\Form\...
1
vote
1answer
96 views

How can I POST x-www-form-urlencoded data from REST API plugin?

In Drupal 8, the REST API plugin can have a serialization format, such as xml or json. This affects the accepted "request formats" for a resource. Is it possible to add a format for application/x-www-...
1
vote
0answers
25 views

How is a plugin swappable? [duplicate]

Hi I am newbe in Drupal 8 and learning the new plugin system introduced in Drupal 8. I understood the concept of pluggin and also created few plugins like block and field fomatters. But I am not able ...
0
votes
0answers
52 views

Migrate from JSON: Setting selected multi-select checkbox list field that is entity reference to taxonomy list in migration yml

We are currently doing a site migration. We have all the data in JSON and have been slowly building the migrations to import this data into drupal 8. We have a taxonomy list of 4 "interests" and we ...
0
votes
1answer
23 views

How to get a variable from FieldWidget in the same modules Template

I have module that is currently setup like this module -signature.module -signature.info.yml -src -Plugin -Field -FieldWiget -SignatureWidget.php -templates -...
0
votes
0answers
25 views

Custom view relationship handler - access view's contextual filter

I've created a custom relationship handler extending RelationshipPluginBase for a view and want to create a specific SQL JOIN ON condition for this relationship. In the query() part of the plugin I'd ...
0
votes
0answers
33 views

Node field watermark image effect on another node field image

I have installed the drupal 8 image effects module and I've made a copy of the ImageEffect WatermarkImageEffect plugin in my custom module. As with all the image effects you've got the constructor, ...
3
votes
1answer
317 views

Execute actions (actions module not rules module) programatically

How can an action from the actions module be executed programatically? In D7 there was actions_do() but in D8 actions are plugins or configuration entities according to https://www.drupal.org/node/...
0
votes
1answer
141 views

How to use ajax in field widget form?

I need to store a country and a region for geographical objects. Countries and regions are stored in a taxonomy vocabulary. Moreover, some countries have regions (as child terms) but someones don't ...
0
votes
1answer
45 views

Custom field - Object could be converted to string

I have a very simple custom field/widget/formatter set. YoutubeLink.php (custom field): <?php namespace Drupal\ad_general\Plugin\FIeld\FieldType; use Drupal\Core\Field\FieldItemBase; use Drupal\...
0
votes
0answers
15 views

Admin path broken after localisation removal

I tried to fiddle with some localisation using modules content_translation, config_translation, locale and language. The problem is, after uninstall of all of the above, the frontend links for block ...
0
votes
1answer
40 views

Extending an existing Plugin class results in Class not Found PHP Fatal Error

I am trying to create my own Plugin that extends an existing Plugin class. I can extend the base class and everything is fine. However, if I extend a existing Plugin class, I get a Class not Found ...
1
vote
1answer
78 views

How to replace a module plugin?

Let's say that I want to replace the block_content_type plugin of the core block_content module to ad some features while not having to rewrite a whole module to achieve this. It is very easy to ...
1
vote
2answers
58 views

Custom plugin modified results in WSOD PluginNotFoundException

I've created a module with a custom Plugin ("group_user"). It all worked great until I modified the code and accidentally introduced an error. This resulted in a WSOD Drupal\Component\Plugin\Exception\...
0
votes
0answers
47 views

Changing a plugin constructor?

There is a plugin being used that extends WidgetBase in Entity Browser module (which extends PluginBase from core). There is an abstract class that extends WidgetBase, and type hints an argument to a ...
0
votes
0answers
53 views

Override a method implemented by a third-party module

I want to change something in a method implemented in a third-party module without hacking the module itself, but overriding the method in my module. The third-party module is views_data_export. I ...
0
votes
0answers
44 views

Rest callback in EntityInterface error

So creating a Plugin/rest/resource/GlaubeweRestResource in my Module and calling the path with a GET request will generate an TypeError in my Drupal 8 Recent log messages: TypeError: Argument 1 ...
1
vote
0answers
289 views

Difference between service and plugin?

After have read some link i'm still confused about the difference between service and plugin. I am not speaking about plugin like block or Field formater etc... i would like to take an example : I ...
0
votes
0answers
34 views

How to translate file field from a plugin block?

I have generated a simple plugin block with Drupal Console. I have added a managed file field during the generation process. Then I would like to translate this block. Unfortunately, this block does ...
1
vote
1answer
39 views

Get labels from fields ordered on block plugin - Drupal 8

I'm trying to create a block with a label list using all labels of a specific field type, entity_reference_revisions. I created a Block plugin and load the EntityTypeManager service. I tried: $...
1
vote
0answers
249 views

Custom exposed view filter plugin drupal 8

I am totally new to drupal 8 I have custom view field plugin created to render the user type permission(anonymous or authenticated) for each node displayed in view. for that i used the content access ...
0
votes
0answers
11 views

cleaner php for getting multiple term names from ID?

This bit of code works for me, but it seems a bit ugly, but I'm not experienced enough to know a cleaner way to write this. I'm getting the term name from an ID three times, to print out in the ...
0
votes
0answers
18 views

Plugin block not displayed in views page

I have a created views (page) to display the number of news articles created in each month (This displays month (number of articles) added in that month like May(12)). I created a content page and ...
0
votes
0answers
192 views

Output rendered entity in twig template of views style plugin

How do I output a rendered entity of a taxonomy term in a views style row plugin template? I am able to access the field gamma from the entity reference field beta of a row with the following code: {...
1
vote
1answer
74 views

Can't pass variable to views style plugin template

How do I pass a variable to a twig template from a preprocess function of a views style plugin in a custom module? In alpha.module, I have tried: function alpha_preprocess_views_view(&$variables)...
1
vote
0answers
170 views

Drupal 8 Aggregator with Custom RSS Field

I have a simple RSS feed I am importing via core Aggregator module in Drupal 8.5. One specific field in the Item can't be accessed by Views, and it's critical for display. I'm relying on hacky ...