Questions tagged [plugins]
Use it for Drupal 8 plugins; for plugins implemented from the Views module use views, ctools for Chaos tool suite plugins.
214
questions
2
votes
0
answers
38
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
85
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
37
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
0
answers
51
views
Help with using migration_lookup with paragraph migration
Drupal core 9.4.5. Paragraphs 8.x-1.2
I am attempting to migrate Drupal 7 books to Drupal 9 paragraphs. I will use custom SQL source plugin which provides all the data I need. I have two D9 ...
0
votes
1
answer
50
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
78
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
119
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 ...
0
votes
0
answers
85
views
How to make custom Views filter plugin dependent on the values of anotherr filter value?
I have created a custom Views filter plugin that filters the node according to nid. This is available as a dropdown plugin. There is another custom Views filter available as dropdown. The value of the ...
0
votes
0
answers
60
views
Custom Simple Action after updating a node
I am trying to create a simple way to execute certain actions on the database every time when I update a node.
I have been looking at Drupal's Action module, however I can't find any good manuals ...
1
vote
1
answer
50
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
746
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
728
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
0
answers
61
views
How do I get JS event attached to multiple views rows
I am creating a custom views field and need it to have JS attached to it's on click functionality. When I get one views result, it works perfectly, but when I have multiple results, it only attaches ...
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
147
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
49
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
134
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
136
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
327
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)
...
1
vote
1
answer
60
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 ...
1
vote
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
141
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
254
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
142
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
754
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
80
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
58
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
209
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
...
1
vote
1
answer
284
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
152
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
126
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
366
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
113
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
102
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
71
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
509
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
148
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
442
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
35
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
836
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
572
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
219
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
120
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 ...
2
votes
1
answer
1k
views
Adding Constraint to entity referenced Paragraph field
I'm attempting to follow this documentation to add a custom constraint to a field in a Paragraph but I'm having trouble in adding constraint to that field.
Currently I have book content type with ...
1
vote
1
answer
931
views
Migrating content with referenced taxonomy field is to be migrated by term name
Is it possible to migrate content with term reference fields, but instead of referencing terms by their tid they are referenced by their term name?
instead of this:
field_tags:
plugin: ...
3
votes
1
answer
95
views
How can I determine which module is associated with a field plugin?
I'd like to implement an entity hook, and act on all fields defined by Computed Field FieldType plugins. So I either need a list of all FieldType plugins provided by the module or need to know which ...
0
votes
1
answer
425
views
Add custom orderBy in ViewsSort plugin
I'm attempting to sort the results of a View by matching one of the Entity IDs in the result set to the referring URL Entity ID. I'm trying to do this in a custom Views Sort plugin. I did some ...
2
votes
0
answers
306
views
migration using csv and yml for multivalued image field
some problem with sub-process plugin. Here are my yml and csv files.
uuid: c0948690-b539-421e-b306-6a49d14afd64
langcode: en
status: true
dependencies: { }
id: migration_multivalues
class: null
...
1
vote
0
answers
53
views
How are custom classes auto-discovered and picked up?
I've been trying to get this sub module working for the better part of 8 hours, but I cannot get any debug/log statements to fire inside the sub module.
Since its only 3 files, I copy pasted the code ...