Categories
CMS Drupal Mastering Development

Issue upgrading from Media Entity to Core Media module

I’ve followed the steps here to update from Media Entity to the Core Media module and I’m running into an issue. My site does use media_entity_image so I updated that one in step 6. I ran drush mecu and everything passed fine. Ran drush updb and updates applied without error. Once I checked out my […]

Categories
CMS Drupal Mastering Development

save views->execute result as a static variable

Does it make sense (performancewise) to store view->execute() as a static variable in order to avoid running same view multiple times? And then call view->render() wherewer I want to print the view? Does it make any sense? Or are there better options? Thank you

Categories
CMS Drupal Mastering Development

Bug in setError when using unlimited cardinality with custom FieldType

I have recently added the field_example (Color RGB) custom field type to my Drupal instance (Drupal version is 8.9.1), didn’t make any changes to the example code, and found that when using unlimited cardinality once I enter a value and press the "Add more items" button, the fields don’t show validation errors on the first […]

Categories
CMS Drupal Mastering Development

Bug in setError when using unlimited cardinality with custom FieldType

I have recently added the field_example (Color RGB) custom field type to my Drupal instance (Drupal version is 8.9.1), didn’t make any changes to the example code, and found that when using unlimited cardinality once I enter a value and press the "Add more items" button, the fields don’t show validation errors on the first […]

Categories
CMS Drupal Mastering Development

Bug in setError when using unlimited cardinality with custom FieldType

I have recently added the field_example (Color RGB) custom field type to my Drupal instance (Drupal version is 8.9.1), didn’t make any changes to the example code, and found that when using unlimited cardinality once I enter a value and press the "Add more items" button, the fields don’t show validation errors on the first […]

Categories
CMS Drupal Mastering Development

Override remove entities link on module uninstall page

When a module needs to be uninstalled, Drupal adds links indicating there is content associated with the module which should be deleted first and provides a link Remove module_name entities. This works fine for most modules, however we have a complex module that needs to perform clean up, is there a way to override this […]

Categories
CMS Drupal Mastering Development

Bug in setError when using unlimited cardinality with custom FieldType

I have recently added the field_example (Color RGB) custom field type to my Drupal instance (Drupal version is 8.9.1), didn’t make any changes to the example code, and found that when using unlimited cardinality once I enter a value and press the "Add more items" button, the fields don’t show validation errors on the first […]

Categories
CMS Drupal Mastering Development

Exception handling for incorrect content type for request in custom REST API plugin

I have created a custom REST API plugin for an endpoint. I have set the accepted format to json using the configuration options. This works. However, if we set the content-type to something other than application/json I am getting a 500 error. I am seeking to know how this exception can be handled more gracefully. […]

Categories
CMS Drupal Mastering Development

Node-linked taxonomies

I have a created node linked a field to taxonomies. I want to create an enrollment form that shows me the node’s title in a drop-down list (that I can do that) and depending on the selected node, the taxonomies dependent on that node will load me (I can’t do that) I get to show […]

Categories
CMS Drupal Mastering Development

Drupal 8 View data export in Excel, date field adds a hidden apostrophe

I use Excel Serialization to export views data on Excel. The exported file (xls or xlsx it doesn’t matter) adds a hidden apostrophe in the beginning of every date cell (’08/07/2011) which can be seen only on the input line. This leads to wrong column sorting. The cell format is Number instead of Date and […]