How to get text formats allowed for the user - Drupal 7Wed, 05/09/2012 - 15:21 | 10 Views
If you are new in Drupal 7 and you need to deal with text formats (format input filters in D6), you will notice a big difference between D6 & D7. We don't have the radio button to set our default text format.
If you are wondering how we can set this default format, the answer lies in the order since Drupal 7 handles the text format with less weight as the default format.
As a reminder, it all depends on the roles assigned to the current user, the default order could be different depending on the role.
In case you need to get this somewhere in the code, you can use the following snippet (devel module required)
uid = 1; $formats = filter_formats($user); //Get all text formats enabled to user:1 dpr($formats); //Get the default format for user:1 $default_format = array_shift($formats); dpr($default_format->format); ?>