Questions tagged [plugins]
Use it for Drupal 8 plugins; for plugins implemented from the Views module use views, ctools for Chaos tool suite plugins.
219
questions
0
votes
1
answer
49
views
How to use node context in custom block plugin to get correct revision for node and its fields?
Background information for this question can be found here: How to have a different hero image per node?
I have written a custom block that takes the data from this "hero" paragraph and ...
-3
votes
1
answer
64
views
"Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginNotFoundException"
I get this exception, which does not say which plugin causes it.
Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginNotFoundException
The "" entity type does not exist. at /var/...
2
votes
1
answer
132
views
How to override a contrib module's FieldType plugin?
I'm trying to override a FieldType plugin provided by the Field Encrypt module:
class EncryptedFieldStorageItem extends FieldItemBase {
I created my own class, MyModuleEncryptedFieldStorageItem, and ...
1
vote
0
answers
81
views
Fatal error: concerning DrushStyle::warning not being compatible with SymfonyStyle::warning
I just upgraded our site from Drupal 9.5.9 to Drupal 10.1 (following instructions from here - https://www.drupal.org/docs/upgrading-drupal/upgrading-from-drupal-8-or-later/upgrading-a-composer-based-...
0
votes
1
answer
331
views
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "node_type" plugin does not exist
I have upgraded drupal 9 to drupal 10 and now while creating a content page or editing the existing content page it is throwing error in error logs
Drupal\Component\Plugin\Exception\...
1
vote
2
answers
161
views
Custom plugin definition not loading
I'm trying to create my own plugin type in Drupal 9 but it's not finding my test definition and I can't figure out why.
Here's my services.yaml:
services:
plugin.manager.reaction:
class: Drupal\...
2
votes
1
answer
311
views
Removing phantom plugin from database
On several sites I've worked on, for whatever reason before I put my hands on it, the database seems to register a plugin that is no longer in config or code.
This usually goes as follows:
[error] ...
0
votes
0
answers
16
views
Special sorting requirement in views for a multi-value field: how to avoid duplicated result items
This is another attempt to solve Custom views filter plugin: filter over two fields of a custom entity where one of the fields is a multi value field in a seperate table
I have create a basefield (...
1
vote
2
answers
77
views
Custom views filter plugin: filter over two fields of a custom entity where one of the fields is a multi value field in a seperate table
I have a custom entity with two basefields of type "list_string": "role" and "additional_role". I need this as "role" is used for sorting the entities by a very ...
1
vote
0
answers
55
views
How is a ckeditor plugin form is discovered and loaded for the plugin? [closed]
I am trying to understand how Text filters settings form are used. For example, if you look at the url_embed module it has:
src/Form/UrlEmbedDialog.php
src/plugin/Filter/UrlEmbedFilter
How does the ...
2
votes
1
answer
121
views
CKEditor 5 - access PHP plugin configuration from JS plugin?
I have provided a CKEditor 5 plugin a PHP configuration class. I am able to set and store configuration for the text editor plugin now, but do not know how to access that configuration value(s) from ...
2
votes
1
answer
169
views
How to create configurable plugins under a plugin manager?
I have a custom plugin type and annotation. The purpose of it is so people can develop their own clients for an API integration, and tell the system which plugin to use to perform these actions. I am ...
0
votes
0
answers
44
views
interaction between form element plugins and config entity plugin collections
I'm making a form element plugin which has compound elements, but which should return a single string value. This is the same idea as core's password confirm form element (https://api.drupal.org/api/...
0
votes
1
answer
98
views
Prevent validation constraint from triggering when 'add more' button is clicked
I have a custom validation constraint plugin that prevents submission if an entity reference field has an odd number of values. The validation triggers upon submission just fine
public function ...
0
votes
1
answer
90
views
How to check in a custom constraint validator whether a field allows for multiple values or not
In my custom validator plugin I want to be able to tell whether the field value given was part of a field that allowed for more than 1 value.
For example
public function validate($items, Constraint $...
-5
votes
1
answer
222
views
How do I execute PHP code in a view?
There are myriad applications to need to execute specific PHP functions in Views rows. In many cases, making a custom Plugin is a better option. In other cases, it's better to use a Twig or custom ...
1
vote
1
answer
67
views
Create a Context/Condition and get a view display used on the page
I want to create a context/condition plugin that checks the total results returned from a view display on the page (its a block), and if its less/greater than a certain figure, hide certain peripheral ...
0
votes
1
answer
1k
views
Migrate PHP version - The "" plugin does not exist
I'm using Drupal 9.3.11 on PHP 7.3. Site is running perfectly. I need upgrade to PHP 8, but I am getting this error.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" plugin ...
1
vote
1
answer
965
views
TypeError: Argument 1 passed to ........ ::__construct() must implement interface Drupal\Core\Cache\CacheBackendInterface, array given, called in
I'm getting an error when I wrote the code using Dependency injection:
TypeError: Argument 1 passed to Drupal\sydneypro_exchange_rates_block\Plugin\Block\ExchangeRatesBlock::__construct() must ...
0
votes
1
answer
69
views
How can I display user information along with its choices?
Usually, polls are anonymized. We need to process total votes, percentages... Now, in the context of Ukraine invasion, an institutional client wants to enhance an Advanced poll existing implementation,...
-1
votes
2
answers
184
views
Dependency injection in create() method of block plugin with derivatives
I am trying to extend the menu_block module to allow it to work with domains (via the domain module). In order to do this I am extending the MenuBlock class, and trying to access the domain.negotiator ...
0
votes
0
answers
60
views
Why would a contributed module try to load one of its files from a custom directory?
I built a module on a local instance in my module/custom directory; I then published it on drupal.org, as Group by Field Widget. For some reason, when I install the release 1.1.1 via Composer, I get ...
1
vote
1
answer
184
views
Use deriver in Drupal Migration yml
I am trying to use the deriver key in a migration yml to have dynamically build migrations for each bundle of an Entity Type (Drupal 9).
I read this and I am trying to use the deriver key to point to ...
0
votes
1
answer
174
views
How to provide an array of values from a context provider
I'm looking into building a custom Context Provider, specifically to provide "groups of the current user". I'm building this for another plugin, a Condition plugin, whose purpose is to ...
0
votes
1
answer
432
views
How to use sql MAX() function in views plugin query
I am creating a custom views filter for a custom views field. The following SQL will accomplish the filter I seek:
select nid, moderation_state, content_entity_id, MAX(content_entity_revision_id)
...
2
votes
1
answer
93
views
Custom field formatter fails in create()
PHPStorm, PHP 7.4
IDE highlights $container->get('date.formatter'), with
"Expected parameter of type '\Drupal\Core\Datetime\DateFormatterInterface', 'object' provided"
This function is ...
2
votes
2
answers
1k
views
How to use migrate process plugin concat on multiple values?
I am trying to import from a csv that has multiple files in the same column, e.g.
title,gallery,tag
node1,img1.jpg|img2.jpg|img3.jpg,2
node2,img4.jpg,2
node3,img5.jpg|img6.jpg,3
I need to prepend the ...
1
vote
0
answers
172
views
How do I override /libraries/ckeditor-wordcount-plugin/lang/some.js?
I'm using ckwordcount module which basically adds nice max length and counter features to text Fields, and relies on WordCount Plugin for CKEditor Editor.
Most of the translations in the plugin lang ...
2
votes
0
answers
335
views
The form argument Drupal\terminal\Form\TerminalCliForm is not a valid form
I've read through other questions regarding the same error message. They all seem to end up being due to typos or the file path. I don't believe that is the case here, but we'll see. I have a working ...
1
vote
1
answer
174
views
Why custom condition is not containing parent entity?
I'm using:
Drupal 9.1.7
Commerce 2.24
I'm trying to create my custom condition (based on https://docs.drupalcommerce.org/commerce2/developer-guide/core/conditions). However parent entity is always ...
1
vote
0
answers
992
views
How to filter entity_autocomplete results by content type and a field
I am trying to implement an entity autocomplete field in a form where the autocomplete entities are filtered by content type and a certain field of that content type.
I know I can filter the ...
0
votes
1
answer
82
views
Purpose of "views_date_format_sql" module
i got back a projet which is using the module views_date_format_sql. This module is not compatible with D9, so I'm trying to find a replacement
But I don't get what this module is supposed to do.
If I ...
0
votes
1
answer
78
views
Class Drupal\dfm\EventSubscriber\DfmSubscriber not found when try to remove the Drupella File Manager
I installed the Drupella File Manager module for Drupal 8.8, but I have Drupal 8.7. I received this error.
Call to undefined method Drupal\Core\File\FileSystem::scanDirectory()
I don't need the ...
1
vote
0
answers
42
views
What is The Best Practice for Custom Plugin Files Placement
I'm going to create a custom plugin type, so I need to create a plugin manager, plugin base, plugin Interface and a plugin annotation, the annotations goes to ModuleRoot/src/Annotation but for the ...
0
votes
0
answers
270
views
Skip_on_empty row method working, but entity still created
I am migrating a field in a node to a paragraph. I am trying to only create the paragraphs where the field has values. That field is an entity reference to another node.
source:
plugin: d7_node
...
2
votes
1
answer
451
views
How do I create a block in a module that can be referenced via an entity reference field?
I'd like to be able to reference my programmed block as a field in a paragraphs.
I've
Generated a module with drupal console - drupal generate:module
Used the template for a block from the example ...
-1
votes
1
answer
176
views
Can't get annotated plugin discovery to fire
I've checked Debug plugin discovery and tried restarting Apache and setting $settings['class_loader_auto_detect'] = FALSE; in settings.php, with no change.
I have a custom module. Setting a breakpoint ...
1
vote
1
answer
165
views
How to remove non breaking space from body/value in migration process?
I am successfully migrating the content from Drupal 7 to Drupal 9. However, I am getting some extra non-breaking spaces I'd like to remove.
I tried using a basic str_replace plugin, but that doesn't ...
5
votes
2
answers
424
views
How can I let a plugin depend on another module?
Is it possible to let a plugin depend on a module (other than the declaring one)?
Use case: I want to create a field widget plugin that should depend on the 'date_all_day' contrib module, but I don't ...
0
votes
0
answers
138
views
How to delete taxonomy terms created with entity_generate process plugin?
I have this json.
{
"ProductKey": "145.1",
"Product": {
"Title": "Product title",
"StartDate": null,
...
0
votes
1
answer
145
views
File structure of libraries folder and detection of module external plugins
The module CKeditor anchor link require a CKEditor plugin.
Can this plugin be placed in subfolder of the /libraries folder or does it have imperatively to be placed at the root of /libraries ?
More ...
1
vote
1
answer
117
views
How to create a view filter plugin to filter a column created by a view field plugin
I have created a view field plugin to display an "internal status" for each node in a view.
Those status are not stored in a table (and should not) because each status may vary depending the ...
0
votes
1
answer
748
views
why am i getting a Drupal\Component\Plugin\Exception\PluginNotFoundException: when the plugin does exist? [closed]
I wrote a custom source plugin and put it in migd8_node_blog/src/Plugin/migrate/source/Node.php
with
<?php
/**
* @file
* Contains \Drupal\migd8_node_blog\Plugin\migrate\source\Node.
*/
...
0
votes
1
answer
182
views
How To Set Order State Completed after Notification?
I am Writing a Payment Gateway(Onsite) Plugin For Commerce 2,
I am Stuck with Checkout Flow Step Transitions.
Let Me Explain:
I am extending the OnsitePaymentGatewayBase and in the createPayment() ...
0
votes
3
answers
551
views
Constraint on paragraph field not working
Here is a very simple code:
1-My constraint plugin (MyConstraint.php)
/**
* @Constraint(
* id = "MyConstraint",
* label = @Translation("Never Validated", context = "...
1
vote
1
answer
38
views
How to get instance of Module / Plugin / Widget of Vote Object in THEME_preprocess_node? [closed]
My drupal site is using the Fivestar Module or from the Vote Up Down Module.
Multiple of my content types are using various implementations of these as fields (specifically comments and my primary ...
2
votes
1
answer
960
views
How can I implement paging for a custom query plugin which displays data from an external API?
Hi I have a requirement to display the data from external api but should not be imported into any entities. What I did is I have written a custom view query plugin which displays the data from ...
2
votes
1
answer
713
views
custom action plugin with ConfigurationForm
I am trying to create a custom action with Configuration Form Field . I am able to create Action and it is being displayed on content page ( /admin/content ) , but I am not able to find the path to ...
0
votes
0
answers
258
views
How to place a plugin block to twig template without any contributed module?
I am using Drupal 8. Have created a custom module, added custom block "LskyTestVideo", created a new page template with its own controller ("LskyOpenTokTestController"). In ...
2
votes
1
answer
134
views
Non-Config Menus
I have this requirement where I would need to create a menu every time a user creates a new instance of a custom entity I'm building. One can easily do this with Menu::create() on entity creation, but ...