Snippets

PHP DOMDocument UTF-8 data into ISO-8859-1 document snippets

Encoding is hard in many cases. Today I ran into one, where we had to save UTF-8 data (from a Drupal website) into an XML document which requires ISO-8859-1 encoding.

We're using https://www.php.net/manual/de/class.domdocument.php for that, which seems to have some problems / flaws with such cases, as the following issues show:

Run Jira Server on Hetzner Managed vServer

Szenario

Wir wollen testen, ob das beliebte Atlassian Jira auch auf einem Hetzner Managed Server betrieben werden kann.
Um das Leistungs-Minimum zu testen, haben wir uns für einen VSERVER MC40 entschieden.

Vorarbeiten

Einordnung:

Drupal 8: Add menu item with anchor link programmatically in .menu.yml

For a Drupal 8 EU Cookie Compliance patch I needed a way to add an anchor link as default menu item programmatically in .menu.yml


example.anchor:
title: "Anchor example"
description: "Scroll to top on the current page"
url: "internal:#top"

Shopware 5 - defekte Varianten entfernen

Es kann in Shopware 5 aufgrund fehlender Validierung im Import / Export passieren, dass "defekte" Varianten angelegt werden. Also Varianten, denen die korrekte Zuordnung zu ihrem Elternartikel fehlt.

Drupal 8: Add field validation constraint programmatically

In foundation_anchor_menu_block module I needed to add a validation to a field in a block to ensure the entered value matches the regex allowed for an "id" HTML element attribute.

Drupal 8: Delete view programmatically

If you should run into the same situation, that you'd like to delete a view programmatically, for example on module uninstall, here you go:

  1. \Drupal::service('config.factory')->getEditable('views.view.' . $view_name)->delete();

Using wget for Cronjob without output

Short snippet to use for a cronjob to call a url if you don't want any output:

* * * * * /usr/bin/wget wget -qO /dev/null https://www.example.com/your-script-to-run

Or to only use HEAD:
* * * * * /usr/bin/wget wget --spider -qO /dev/null https://www.example.com/your-script-to-run

For further details see https://www.gnu.org/software/wget/manual/wget.html

Einordnung:

Download PDFs in Cordova InAppBrowser (3.1.0)

I wasted several hours on handling PDF downloads in cordovas inAppBrowser.

My situation was that a page was loaded in inAppBrowser which contained links to PDF Downloads from the same host.
The links simply didn't work.

JTL-Shop 4 "keinBild.gif" Platzhalter Grafik updatesicher ersetzen / überschreiben

Heute ein kleiner Tipp für JTL-Shop Entwickler: Wenn ihr die Platzhalter-Grafik für "Kein Bild vorhanden", z.B. für Kategorien, Produktbilder o.Ä. kundenspezfisch und updatesicher durch Grafiken aus Eurem JTL-Shop Template ersetzen möchtet, könnt ihr dies durch folgende Einträge in der Konfiguration erzielen (Beispiel):

Drupal CMS: Change user profile title & tab title

Since I needed some time to find out how to change the user profile tabs title and page title, I'd like to share that information with you.