Hi Madelyn, glad the code is helpful!

1) This code is not meant to prevent deletion of parent/child terms. It prevents deletion of terms that are referenced by a node. Eg. if at least one of your nodes was tagged with a taxonomy term named 'tag1', you will not be able to delete 'tag1'.

However I just realized that there is a possible scenario of unintentional deletion even with this code in place. Before deleting a parent item, this code checks whether it is referenced by nodes, but does not check the term's children. The problem is Drupal will delete children automatically when deleting a parent term. My use case doesn't require parent/children relationships, so I haven't encountered this issue yet. If you find a clean solution for this, let me know.

2) When there is only one statement, you can skip the brackets to save a line of code.

  1. if ($show_insides)
  2. print 'I am inside the if statement.';
  3. print 'I am outside.';

Not sure if this adheres to Drupal coding standards. Either way correct indentation is critical for readability.

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.

Restricted HTML

  • Erlaubte HTML-Tags: <a href hreflang target> <em> <strong> <cite> <blockquote cite> <pre> <ul type> <ol start type> <li> <dl> <dt> <dd> <h4 id> <h5 id> <h6 id>
  • Zeilenumbrüche und Absätze werden automatisch erzeugt.
  • Website- und E-Mail-Adressen werden automatisch in Links umgewandelt.

Angebot innerhalb von 24 Stunden

Ob ein großes kommerzielles System, oder eine kleine Business Seite, wir schicken ein Angebot ab innerhalb von 24 Stunden nachdem Sie diese Taste drücken: Angebot anfordern