The code looks good, do some thorough testing and that should be it.

The two statements on this line

  1. if (count($results) > 0 && !empty($results)) {

both do the same. empty() works on an array and returns TRUE if the array has no elements. You can remove one of these checks.

Also I would probably split the two checks into their own functions for readability. One would be testing for referenced nodes, the other one would check for child terms. If this functionality is fragment of a bigger whole, I would go further and advise to start using objects (yes, you can code OOP in D7) as this is much cleaner and will start preparing you for Drupal 8. See this article to see where D8 is at.

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