Styling the comment form
In this recipe, we will look at manipulating form elements and markup using the Form API in an effort to make styling elements of the comment form easier. To be precise, we will be altering the comment form displayed to anonymous users in order to position its contact fields within a DIV
block, thereby allowing us to target them better via CSS.
Getting ready
We will be using the mysite module created earlier in this book to contain an implementation of hook_form_alter()
. Since we are going to be working on the comment form, it is assumed that the Comment module is enabled.
Drupal's default permissions do not permit anonymous users to view or add comments. These permissions can be added via the Permissions management page at admin/user/permissions
(Home | Administer | User management | Permissions). To assist with debugging, it is also recommended that, if the Devel module is enabled, anonymous users be allowed to access debugging output via its permissions.
Finally...