Form has a div within it. How can I add classes to this div? There's a div called .description in a form in the site I've inherited. I want to add a another class to the div.

The div's content is created within hook_form_FORM_ID_alter(), eg:

$form['#description'] = 'Please enter your full name';


I've tried adding a classed to it like:

$form['#description'] = [
    '#markup' =&gt; '&lt;div class="my-class"&gt;Please enter your full name&lt;/div&gt;',
  ];


But this just results in "Array" being printed.

Would anyone know what I could do add a class to this element?
That's not what you want. What you want to do is add it to the form structure like this:

$form['#attributes']['class'][] = 'my-class';


Since you didn't list an element on the form, I can only assume you want the class on the form itself. If you want to wrap an element with a div with a class on it, you can do:

$form['element']['#prefix'] = '&lt;div class="my-class"&gt;';
$form['element']['#suffix'] = '&lt;/div&gt;';


That will wrap the entire element.