Brisbane!
Account created on 5 November 2014, over 10 years ago
#

Merge Requests

More

Recent comments

🇦🇺Australia jannakha Brisbane!

updated version to 2.2.x dev

🇦🇺Australia jannakha Brisbane!

@mark_fullmer
Hi Mark,
Linkit and other modules with plugins for CKEditor5 are having lots of issues with v45 since it had some big changes.
I was testing linkit on OOTB 10.5 and 11.2 and it had some inconsistent behaviour (loosing attributes, not working with other CKEditor plugins) (Also CKEditor5 v45 have updated how "Displayed text" is being updated).

I've started refactoring of the plugin - let me know your feedback.

cheers,
Janna

🇦🇺Australia jannakha Brisbane!

jannakha changed the visibility of the branch 3535479-refactor-linkit-plugin to hidden.

🇦🇺Australia jannakha Brisbane!

- MR created
- screenshot after patch applied

🇦🇺Australia jannakha Brisbane!

@stewest how do you configure linkit to display "External Url" group?
mine just shows No results (see screenshot): https://www.drupal.org/files/issues/2025-07-11/linkit-external.png
and your test URL is inserted correctly (no double-encoding).

🇦🇺Australia jannakha Brisbane!

tested on D11 - links with encoded strings are double encoded.
created a patch out of #7

TODO: tests

🇦🇺Australia jannakha Brisbane!

jannakha made their first commit to this issue’s fork.

🇦🇺Australia jannakha Brisbane!

@jacobbell84 can you please create a merge request our of patch for a faster review and testing?

🇦🇺Australia jannakha Brisbane!

@robertom thanks for your patch!
tested and fixes the issue.
patch moved to MR

Note: EntityMatcher.php has this fixed, but TermMatcher.php requires this patch.

🇦🇺Australia jannakha Brisbane!

jannakha made their first commit to this issue’s fork.

🇦🇺Australia jannakha Brisbane!

@lily.yan can you please create a merge request our of patch for a faster review and testing?

🇦🇺Australia jannakha Brisbane!

tested on D10.5
with the patch applied - if Linkit filter is not applied to editor, linkit.js is not loaded - as per fix.

Note: D11.2 wouldn't load linkit.js even without the patch.

🇦🇺Australia jannakha Brisbane!

install https://www.drupal.org/project/ckeditor5_plugin_pack and enable "CKEditor 5 Bookmarks" and add it to editor in Text formats and editors, it works with this module fine.

more info with screenshots: https://www.drupal.org/project/editor_advanced_link/issues/2595337#comme... Add "Anchor" button Needs review

🇦🇺Australia jannakha Brisbane!

thanks for your MR!
@s_leu would you like to publish your MR and move the issue to "Needs review"?

🇦🇺Australia jannakha Brisbane!

here's how to use links/bookmarks between different pages:
Example:
- create a link (or bookmark) on /node/1 with id test123, save
- create a link on /node/2 with URL /node/1#test123, save

here's screenshots:
create link:

rendered link:

also bookmarks (anchors) are available see comments: https://www.drupal.org/project/editor_advanced_link/issues/2595337 Add "Anchor" button Needs review

🇦🇺Australia jannakha Brisbane!

either use id attribute of this module,
or install https://www.drupal.org/project/ckeditor5_plugin_pack and enable "CKEditor 5 Bookmarks" and add it to editor in Text formats and editors, it works with this module fine.

here's a screenshot
insert bookmark:

link to bookmark:

🇦🇺Australia jannakha Brisbane!

before/after:

patch good to go!
thanks for your contribution.

🇦🇺Australia jannakha Brisbane!

Which version of drupal are you testing on?

Is it possible for you to upgrade Drupal to 10.5 or 11.2?

🇦🇺Australia jannakha Brisbane!

as an alternative - you can try install https://www.drupal.org/project/ckeditor5_plugin_pack and configure required target attributes values as toggles

🇦🇺Australia jannakha Brisbane!

https://www.drupal.org/project/editor_advanced_link/issues/3495735 Add 'lang' attribute option Active

🇦🇺Australia jannakha Brisbane!

CKEditor5 45+ comes with Displayed Text OOTB

🇦🇺Australia jannakha Brisbane!

CKEditor5 is building its own form within javascript
you might want to create your own CKEditor5 plugin to suit your requirements

🇦🇺Australia jannakha Brisbane!

as an alternative - you can install https://www.drupal.org/project/ckeditor5_plugin_pack and configure required rel attributes as toggles

🇦🇺Australia jannakha Brisbane!

there's a configuration in Drupal to enable target attribute which is then processed by CKEditor
target attribute is processed by CKEditor5 OOTB

🇦🇺Australia jannakha Brisbane!

CKEditor5 45+ had some major changes on how they are processing attributes,
can you test this patch: https://www.drupal.org/project/editor_advanced_link/issues/3534699 📌 Refactor custom JS for CKEditor5 v45+ Active

🇦🇺Australia jannakha Brisbane!

@DuaelFr
Hello from Australia! I'm working with @vladimiraus and I did a refactoring of JS files to be more inline with CKEditor5 45+ - would you like to collaborate on it? I'm on slack or here.

🇦🇺Australia jannakha Brisbane!

this also fixes:
https://www.drupal.org/project/editor_advanced_link/issues/3519379 🐛 Fix keyboard accessibility of advanced attribute fields Active
https://www.drupal.org/project/editor_advanced_link/issues/3534044 🐛 Adding "Open in new window" removes all other attributes Active
https://www.drupal.org/project/editor_advanced_link/issues/3391226 🐛 matcher-pattern-deprecated-attributes-class-key ckeditor warnings Active

🇦🇺Australia jannakha Brisbane!

thanks for your work!
tested on D11 - no more warnings!

🇦🇺Australia jannakha Brisbane!

jannakha changed the visibility of the branch 3534699-refactor-custom-js to hidden.

🇦🇺Australia jannakha Brisbane!

core dependencies fixed for 11.1
core dependencies do have a limitation on defining ranges of core versions, please read documentation for which version to use

🇦🇺Australia jannakha Brisbane!

CKEditor 4 is not supported.

🇦🇺Australia jannakha Brisbane!

try applying appropriate font to your pdf: https://www.drupal.org/project/entity_print/issues/3011414 🐛 Dompdf not rendering Russian / cyrillic characters Needs review

🇦🇺Australia jannakha Brisbane!

Comment #9 of https://www.drupal.org/project/entity_print/issues/3011414 🐛 Dompdf not rendering Russian / cyrillic characters Needs review

Here's an example of PDF with Polish characters:

does setting font it work for you?

🇦🇺Australia jannakha Brisbane!

try adding compatible font to your print pdf
https://www.drupal.org/project/entity_print/issues/3011414 🐛 Dompdf not rendering Russian / cyrillic characters Needs review

🇦🇺Australia jannakha Brisbane!

I've added a new font like in: https://www.drupal.org/project/entity_print/issues/3011414 🐛 Dompdf not rendering Russian / cyrillic characters Needs review
and PDF was rendered like this on D11:

try adding a compatible font to your print css

🇦🇺Australia jannakha Brisbane!

applied patch #8 - no effect

if you add this font to css Cyrillic renders fine:

body {
  font-family: 'DejaVu Sans', sans-serif;
  color: #000;
}

🇦🇺Australia jannakha Brisbane!

this looks like an outdated issue, tested on D11.2 Entity Print Version: 8.x-2.16

🇦🇺Australia jannakha Brisbane!

before patch: Input value "view_args" contains a non-scalar value.
after patch: View works!

Note: on line #100 ViewPrintController::viewPrint has $this->currentRequest->query->all('view_args').

Created MR!77 from patch for easier merging (thanks @kaszarobert)
Re: https://www.drupal.org/node/3213138

🇦🇺Australia jannakha Brisbane!

this looks like an outdated issue and can be closed?

🇦🇺Australia jannakha Brisbane!

jannakha changed the visibility of the branch 3466043-fix-phpcs-and-v2 to hidden.

🇦🇺Australia jannakha Brisbane!

jannakha made their first commit to this issue’s fork.

🇦🇺Australia jannakha Brisbane!

patch applied,
dpi changed to 300 and it reflected in PDF

@jwylarsen how do you style your PDFs for PDI 300?
my PDFs turned out very small it prints out
this is DPI 96 version

🇦🇺Australia jannakha Brisbane!

@immaculatexavier - thanks for a quick fix!
tested on D11, works as described

🇦🇺Australia jannakha Brisbane!

@eszszabo thanks for the screenshot, but it doesn't really help with which handler is missing.
Do you have a screenshot of D10 to compare to?
what's the name of the handler which is missing? (you can see it in configuration yml of the view)

🇦🇺Australia jannakha Brisbane!

you might want to ask to be a maintainer of the module - it's always beneficial to have multiple maintainers and this project hasn't been released for 2 years

🇦🇺Australia jannakha Brisbane!

@hitfactory - can you provide more use cases for it? screenshots?
I've applied patch and set font ration to 4, if affected rendered PDF but has not affected /debug preview.
I'm not sure what's the use case for it.

🇦🇺Australia jannakha Brisbane!

@milosr can you provide more information and screenshots?

I've had entity print on view to print each node as Custom Text since Drupal 8 (now Drupal 10.5):
<a href="/print/pdf/node/{{ nid }}" title="download pdf for {{ title_2 }}"><span class="file file--mime-application-pdf file--application-pdf"> </span></a>

Do you have another module? or custom code?

🇦🇺Australia jannakha Brisbane!

@ady1503 thanks for your work!
Re comment #4: create a new issue for optional css classes View PDF link on a node (to keep different features separate for easy testing/merging).

🇦🇺Australia jannakha Brisbane!

@ady1503 thanks for code you've provided. I've moved code to MR and updated task description.

Problem/Motivation

Hello.

I make some changes in code for make posibility to transform link "View PDF" in Views, from module to button.

Its must nicer view and for mi best option.

If you want add this is your module and your decision.

Here before:

And after:

And view:

I add sinitize function for security reazon.

And for default button classes is empty, user need add some css for button, in mi example I use Olivero default button css:

button button-action button--primary button--small

Thanks for your module.

Gracias

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

<?php

namespace Drupal\entity_print_views\Plugin\views\area;

use Drupal\Component\Utility\Xss;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\entity_print\Plugin\ExportTypeManagerInterface;
use Drupal\views\Plugin\views\area\AreaPluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Views area handler for a Print button.
 *
 * @ingroup views_area_handlers
 *
 * @ViewsArea("entity_print_views_link")
 */
class EntityPrintViewsLink extends AreaPluginBase {

  /**
   * The export type manager.
   *
   * @var \Drupal\entity_print\Plugin\ExportTypeManagerInterface
   */
  protected $exportTypeManager;

  /**
   * Constructs a new Entity instance.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\entity_print\Plugin\ExportTypeManagerInterface $export_type_manager
   *   The export type manager.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, ExportTypeManagerInterface $export_type_manager) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->exportTypeManager = $export_type_manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('plugin.manager.entity_print.export_type')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state): void {
    parent::buildOptionsForm($form, $form_state);
    $form['export_type'] = [
      '#type' => 'select',
      '#title' => $this->t('Export Type'),
      '#options' => $this->exportTypeManager->getFormOptions(),
      '#required' => TRUE,
      '#default_value' => $this->options['export_type'],
    ];
    $form['link_text'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Link text'),
      '#required' => TRUE,
      '#default_value' => $this->options['link_text'],
    ];
    $form['class'] = [
      '#title' => $this->t('Class'),
      '#description' => $this->t('A CSS class to apply to the link. If using multiple classes, separate them by spaces.'),
      '#type' => 'textfield',
      '#default_value' => $this->options['class'],
    ];

    $displays = $this->view->displayHandlers->getConfiguration();
    $display_options = [];
    foreach ($displays as $display_id => $display_info) {
      $display_options[$display_id] = $display_info['display_title'];
    }
    $form['display_id'] = [
      '#type' => 'select',
      '#title' => $this->t('View Display'),
      '#options' => $display_options,
      '#required' => TRUE,
      '#default_value' => $this->options['display_id'],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function render($empty = FALSE): array {
    if ($empty && empty($this->options['empty'])) {
      return [];
    }

    // Check if the user add css for button.
    if (!empty($this->options['class'])) {
      // Definir las clases proporcionadas.
      $user_defined_classes = $this->options['class'];
      // Sanitizar cada clase usando Xss::filter().
      $sanitized_classes = explode(' ', $user_defined_classes);
      foreach ($sanitized_classes as $class) {
      $sanitized_classes[] = Xss::filter($class);
      }
    } else {
      $sanitized_classes = [];
    }

    $route_params = [
      'export_type' => !empty($this->options['export_type']) ? $this->options['export_type'] : 'pdf',
      'view_name' => $this->view->storage->id(),
      'display_id' => $this->options['display_id'],
    ];

    return [
      '#type' => 'link',
      '#title' => $this->options['link_text'],
      '#url' => Url::fromRoute('entity_print_views.view', $route_params, [
        'query' => $this->view->getExposedInput() + ['view_args' => $this->view->args],
        'attributes' => [
          'class' => $sanitized_classes,
        ],
      ]),
    ];
  }

  /**
   * {@inheritdoc}
   */
  protected function defineOptions(): array {
    $options = parent::defineOptions();
    $options['export_type'] = ['default' => 'pdf'];
    $options['link_text'] = ['default' => 'View PDF'];
    $options['class'] = ['default' => ''];
    $options['display_id'] = ['default' => $this->view->current_display];
    return $options;
  }
}

API changes

Data model changes

🇦🇺Australia jannakha Brisbane!

jannakha made their first commit to this issue’s fork.

🇦🇺Australia jannakha Brisbane!

- installed module on D11.2
- config returns error
- applied patch from MR8
- config form works again!
thanks for fix and your contribution to open source!

maintainers, please push to release!

🇦🇺Australia jannakha Brisbane!

just curious,
- why https://www.cyber.gov.au/node/add/testXYZ returns 404, but
- why https://www.cyber.gov.au/node/add/тест would return unhandled exception?
should it just return 404?

Patch throws an exception, but it has to be handled somewhere - at the moment any Drupal website shows white screen of death on 'node/add/тест'.

🇦🇺Australia jannakha Brisbane!

applied MR4 to Drupal 11
before

after

Links don't render token

🇦🇺Australia jannakha Brisbane!

applied patch to D11, it seems to work, but it's very unintuitive how to use it.
maybe add description to "Field wrapper - Other field" what kind of field it should be, eg "list_string field and should be validated that its a valid html tag."

also, maybe it should be a separate field formatter which extends TextFieldFormatter not to add too much complexity and clutter to the code ?

#[FieldFormatter(
  id: 'text_field_wrap_formatter',
  label: new TranslatableMarkup('Text field formatter with wrap field'),
  field_types: [
    'string',
  ],
)]
class TextFieldWrapFormatter extends TextFieldFormatter {
...
}

(MR8 doubles complexity of the code).

🇦🇺Australia jannakha Brisbane!

duplicate of #3526863

🇦🇺Australia jannakha Brisbane!

fixed in #3526863

🇦🇺Australia jannakha Brisbane!

Bartik is depricated
new issue is #3533305

🇦🇺Australia jannakha Brisbane!

@joseph.olstad

yes, I tested it on D11 (comment #2 is correct too)

MR7 doesn't have any functional changes, it contains PHPCS fix (code formatting) and array manipulation.
the module now expects Drupal 10.2+ or 11 (no more 8+) (since other Drupal versions are not supported it makes sense)

🇦🇺Australia jannakha Brisbane!

#MR35 and #34 fixed the console error - thank you!

please push to stable release

🇦🇺Australia jannakha Brisbane!

before patch: CKEditor is broken, errors in console
applied patch #4 to Drupal 10.5.1
no errors in console, CKEditor 5 is restored!

thanks for the patch!
please release!

🇦🇺Australia jannakha Brisbane!

@bluegeek9 can you please release a stable release with D11 support etc?

last release was 2 years ago

🇦🇺Australia jannakha Brisbane!

@murphyw @Leo liao - thanks for your patches!
can you please create a merge request (it will speed up testing and releases)

🇦🇺Australia jannakha Brisbane!

so, I installed a brand new Drupal 11 site, created a couple of vocabs and taxonomy terms,
then installed taxonomy manager with patch (before langcode fix).

Because by default (even without multi-lingual support) langcode is set to 'en' but taxonomy manager is searching for 'und'
so duplicates are added anyway:

After langcode set to 'en' - duplicates are not created (matched to langcode 'en').

There'll be an issue with all terms which were created with taxonomy_manager before this fix (as they are created with langcode 'und')

🇦🇺Australia jannakha Brisbane!

added langcode check for non-multilingual sites

🇦🇺Australia jannakha Brisbane!

I have tested the patch and found an interesting issue, if vocabulary was setup with langcode (but module is not enabled - data and structure has been migrated from D8->D9->D10 and some stage language module might have been enabled) it will not match duplicates.

Maybe add additional langcode check:

      // Check if site is multilingual.
      if ($this->moduleHandler->moduleExists('language')) {
        ...
      }
      else {
        $vocabulary = \Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary')->load($vid);
        $langcode = $vocabulary->get('langcode');
      }
🇦🇺Australia jannakha Brisbane!

all tasks completed

🇦🇺Australia jannakha Brisbane!

please fix phpcs issues

🇦🇺Australia jannakha Brisbane!

duplicate of #3014694

🇦🇺Australia jannakha Brisbane!

can you please fix JSLint, PHPCS errors?

Production build 0.71.5 2024