Questions tagged [plugins]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
90 views

How do i add a background image to a imput submit button in my module?

So i have a input submit button that needs an image. I've been looking at the module styling documentation where it says i can attach the styling to a render array of a block plugin. What does this ...
  • 1
0 votes
2 answers
335 views

How can I alter the list of available layouts in the Panels IPE?

I'm trying to hide or remove several layouts from the layout selectors, so that users can only select from an approved list. I can do this successfully with hook_form_alter() code, but the Panels IPE ...
  • 187
1 vote
1 answer
983 views

Views row style plugin override not saving in Views UI

In my ongoing journey to create a customized RSS feed in my D8 site, I've finally gotten closest to what I need by using a Feed display in Views. The basic feed is working, but I need to add a couple ...
  • 1,181
0 votes
1 answer
701 views

How can I programmatically insert content via a script or import instead of through the UI?

I have a custom content type and I now need to create thousands of entries using that type. It would take a very, very long time to go through the interface and add these one by one. I'm hoping there ...
  • 129
1 vote
0 answers
155 views

Drupal 8 change url to absolute

I want to change my all internal url to absolute from relative as of now. For e.g. my menu link urls are "/about" as so on I want this to be absolute url like xyz.com/about. How can I do this ?
  • 101
5 votes
1 answer
6k views

How to create my own custom simple action in D8?

I'm creating a view that is used to review migrated content that was flagged for review during the migration process. I want to provide a bulk action on this view that allows the user to select a ...
  • 1,042
1 vote
1 answer
164 views

Functional test not displaying context aware block

I have a context aware block I've created. /** * Provide a context aware block. * * @Block( * id = "my_context_aware_block", * admin_label = @Translation("My context aware block"), * ...
1 vote
1 answer
656 views

"The 'entity_type:block_content_type' plugin does not exist." Why? How?

My boss and I have inherited a Drupal 8 site from another developer, and every attempt to do database updates or cache rebuilds triggers a fatal exception: ‘The “entity_type:block_content_type" plugin ...
1 vote
0 answers
583 views

How do I extend a protected core function? [closed]

In core\modules\menu_link_content\src\Plugin\Menu\MenuLinkContent.php is a protected function getEntity(). I want to "make" this function public. Can I do this by extending the class MenuLinkContent? ...
0 votes
1 answer
358 views

Creating field with multiple properties

I am creating a Field plugin, where I have requirement as below Field name : Question Properties: Question Text : String Question Type : integer (0,1,2) Question Options : Array of Strings I ...
1 vote
2 answers
1k views

How can I access block metadata from custom plugin instance?

Using the block_example module, I created two instances of the example_configurable_text block in the UI and would like to now access their underlying metadata, specifically uuids. By looking at the ...
  • 103
1 vote
0 answers
22 views

Mapping remote api data to view rows

I created a custom view with fields. I have a client file that pull data from the api, using an endpoint. On my code in the execute method of the view, I have this lines: public function execute(...
5 votes
2 answers
1k views

Debug plugin discovery

A plugin that I have written is not being discovered. For eg : https://www.drupal.org/node/2847639 Is there a general suggestion for debugging failing plugin discovery?
  • 6,573
1 vote
0 answers
38 views

How to execute a custom code when a plugin instance is deleted?

I have a custom plugin that implement a context reaction like this: namespace Drupal\mymodule\Plugin\ContextReaction; /** * Provides a context reaction. * * @ContextReaction( * id = "banner", ...
1 vote
0 answers
1k views

Display result using execute(ViewExecutable $view)

I wrote code that should display the hard-coded value $name in $row to the view field. public function execute(ViewExecutable $view) { $name = 'Jackie Chan'; $index = 0; ...
2 votes
0 answers
302 views

Creating custom views query plugin and pull data from CVR

I created a custom views query plugin following this article: Building Views Plugins for Drupal 8 In my case, I am pulling data from a CVR registers and not Fitbit. My Goal: I want to pull data ...
1 vote
1 answer
1k views

How do I create a custom plugin?

Basically, I want to port a custom ctools plugin created for content type from Drupal 7 to Drupal 8. This is the code I want to port. function my_module_ctools_plugin_directory($module, $plugin) { ...
  • 654
4 votes
1 answer
3k views

How do I inject a dependency into a @FieldType plugin?

I am implementing custom fields in Drupal 8 (types, widgets, formatters). @FieldType plugins are instantiated by their respective plugin manager (\Drupal\Core\Field\FieldTypePluginManager) which does ...
2 votes
2 answers
2k views

Destination fields not filled from custom migration process plugin

I'm working on a D6 -> D8 migration, and my destination has a custom video upload field (field_video_upload) that contains three pieces of data: video, thumbnail, and poster (field_video_upload_video, ...
  • 1,181
3 votes
1 answer
845 views

Migrating into custom node type with multi value field

I'm doing a migration into D8, and I'm migrating into a custom video player field with multiple values. Here's the schema for the field as defined in its plugin: public static function schema(...
  • 1,181
0 votes
3 answers
3k views

Migrate custom source plugin not found

I have a fairly simple D6->D8 migration, and I need a custom source plugin for one of my node migrations. As far as I can tell, I have everything written and structured properly, but when I click on ...
  • 1,181
7 votes
2 answers
8k views

Need to override single Drupal 8 plugin function

What I want to do is edit what is displayed in the autocomplete/drop selects for an entity reference. Basically instead of just [title] I want to show [title] - [other_distinguishing_field]. I know ...
0 votes
1 answer
74 views

in ckeditor plugin, why isn't my getConfig returned array affecting editor?

I'm including the wordcount plugin to CKEditor in D8. I'm including some configuration (maxWordCount) through the configurable interface. The issue I'm having is that no matter what I return from ...
0 votes
2 answers
1k views

Allow html tags in Form submit button in block plugin

I'm using a block plugin to render a user specified form. I'm retrieving the form like so: public function blockSubmit($form, FormStateInterface $form_state) { $this->configuration['template']...
  • 5,442
0 votes
1 answer
741 views

How to enable IMCE in a field of a custom block

I have module that generates a plugin block with a field of type managed_file. public function blockForm($form, FormStateInterface $form_state){ $config = $this->getConfiguration(); // ...
0 votes
1 answer
43 views

generate multiple custom blocks from a single api call

I have created a custom module that generates a single custom block based on content retrieved from a remote API. The content is currently displayed in a single contiguous block above the main content....
  • 1,221
4 votes
2 answers
2k views

How to override existing plugin?

Considering Drupal\search_api\Plugin\views\query\SearchApiQuery class, I want to override shouldAbort() method there. I have tried to create a new plugin class in my custom mod: namespace Drupal\...
  • 4,955
3 votes
1 answer
2k views

Adding fields to entity (menu_link_content) form (menu_link_edit)

I have been diving into Drupal 8, it's plugin system and all the new stuff for some days now. I hope that I understood the basics and now I would like to start out with a new module. The module ...
  • 211
0 votes
1 answer
407 views

entity_get_form_display setComponent throws "plugin does not exist" regardless of type

I'm trying to programmatically add a field to a custom bundle, and have it appear on the custom entity type. I'm using a BaseForm extended class, and have acquired an entityManager elsewhere using ...
  • 459
1 vote
0 answers
36 views

Is it possible to queue up a content block within a plugin block?

I have a plugin block that returns a render array based on taxonomy of the node. I want to make a default custom block appear when there's no taxonomy term selected. I've tried this: else { $block =...
-2 votes
1 answer
70 views

How can I call the javascript plugin

How can I call a JAVASCRIPT plugin in Twig template? I try to use something like this code in my html.html.twig template, but it seems that this not work correctly: <script> $(document)....
0 votes
1 answer
2k views

How to add any plugin to ckeditor manually? [duplicate]

I'm trying to add a new plugin ckwebspeech in ckeditor module. Here is the plugin which I want to add. So, that the final editor will look like mentioned in screenshot. Is there any way to add this ...
1 vote
1 answer
797 views

Retrieve GET request from Block Plugin

I'd like a block plugin to display content dependent on a GET request. Inside my block plugin I have class BlogPage extends BlockBase { public function build() { $query = \Drupal::...
  • 5,442
3 votes
2 answers
3k views

CKEditor custom plugin to add richcombo select list

I am building a CKEditor plugin for Drupal 8. I've done plugins that show a button in the editor toolbar, but this one should render a select list. The list is not showing up in the configuration page ...
  • 299
8 votes
1 answer
3k views

How set a time type field programmatically?

I create a custom content entity type. I want one field for the event time. Since there is no time field, but a dataTime_type, I create a plugin for a custom field : FieldType : TimeItem.php /** ...
  • 2,498
6 votes
1 answer
7k views

Twig Template for a Custom Block Plugin

I'd like to have a custom twig template for custom block plugins from my custom module. My custom block HeaderText contains public function build() { return array( '#title' => 'Test', ...
  • 5,442
5 votes
1 answer
777 views

Block Plugin Derivatives Discovery

I need some help with my code. I am creating blocks dynamically using the plugin derivatives. I store some form data in a database table, then I display it in each block separately, depending on it's ...
0 votes
1 answer
48 views

Adding markup to fields in block plugins

I'm attempting to create a block plugin that renders nodes retrieved from a query. I'm able to successfully get the node id's and field values from the query but I'd like to wrap each item in divs and ...
  • 5,442
0 votes
2 answers
1k views

text_format field value not appearing in full_html mode

I'm using a block plugin to display content based on what the user inputs into a form. Select boxes, and radio buttons are saved and displayed in the form just fine but the text_format field isn't ...
  • 5,442
0 votes
1 answer
100 views

Using arrays when setting values in defaultConfiguration() of BlockForm in BlockBase

I'm writing a block plugin that allows you to specify certain values for the block in the panel pane editor. I'm able to defined the default values using public function defaultConfiguration() { ...
  • 5,442
0 votes
1 answer
2k views

Adding Bootstrap Tabs to a content view

I've created a custom content type which I want to display in a view using Bootstrap's Tabs component. I've found this tutorial of sorts, but I'm a bit lost trying to process it all (I'm very new to ...
  • 336
2 votes
2 answers
884 views

Create a custom area plugin

I'm looking to add a plugin for Views to provide some custom functionality in the footer of a view. First, I created the following in my_module/src/Plugin/views/area/MyPlugin.php: namespace Drupal\...
  • 562
0 votes
1 answer
47 views

Creating a Feeds Plugin Child from a custom module and calling the new method

I’ve got a module where I need to overwrite a method from another Feeds Plugins class. To do this I’ve followed the developer's guide to Feeds. So I have implemented hook_feeds_plugins and ...
  • 670
1 vote
0 answers
647 views

How do I create an instance of a search plugin?

I created a custom search plugin to index and search a sub-set of taxonomy terms and their fields, as these are used as landing pages. In addition, we are using the node search. This gives us two ...
user avatar
0 votes
1 answer
64 views

Field as Block column not showing

I installed the Field as Block plugin without problems, but when I go to Structure > Content Types > Basic Page > Manage Display, I still don't see the "Display as block" checkbox. I tried googling ...
  • 217
0 votes
1 answer
122 views

Problem extending BookNavigationBlock

i have a Problem extending a BookNavigationBlock Plugin. When I extend BlockBase it works, but when trying to extend BookNavigationBlock, it fails when placing the block, without any error messages. ...
2 votes
1 answer
87 views

How do I find the correct plugin?

As an Drupal 7 developer I'm currently trying to get into Drupal 8. I got a problem finding the right plugin. For example, I simple want to change the text of a node link "read more" into "read more >...
  • 81
0 votes
0 answers
992 views

Implement condition plugin

namespace Drupal\my_block\Plugin\Condition; use Drupal\Core\Condition\ConditionPluginBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Symfony\...
5 votes
1 answer
5k views

How do I add extra/custom plugins in CKEditor?

I am copying the templates plugin http://ckeditor.com/addon/templates I put it in my D8 folder /core/asstes/vendor/ckeditor/plugins I do a 'drush cr' I do not see the templates plugin under ...
0 votes
1 answer
53 views

How to extend Views Plugin ViewsSelection.php to have $form_state

I need to add in the current $form_state into the ViewsSelection. I have copied the file /core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php to /modules/custom/fsed_entry/...