I was looking to use a text editor with statuses. Statuses is neither a Node nor an Entity. I searched a lot and found a simple solution. I just has to replace '#type' => 'textarea', with '#type' => 'text_format', in statuses/includes/utitlity/statuses.form.inc file. It converted it to a text format enabled textarea, but there are few problems.

  1. Ckeditor is not respecting the character limit set by the module, so I found maxlength module and added '#maxlength_js' => TRUE, but it does not make the default work. Instead it adds a separate character counter. The markitup library is respecting this, but I want to use ckeditor as I think it is the best editor. How to overcome it?

  2. The form is now scrollable after enabling ckeditor. I want to disable scrolling. The resizeable was already set to FALSE in the module, but ckeditor is not respecting it. How to solve it?

  3. How to hide paragraph counter and word counter? I have not enabled it from settings. I was there by default.

Here is the SnapShot of the statuses form.

enter image description here

Code was added like this: Only 2 modifications were made to the code, the rest is the original code of the module.

$form['fbss-status'] = array(
    '#type' => 'text_format',
    '#rows' => variable_get('statuses_box_rows', 2),
    '#maxlength_js' => TRUE,
    '#maxlength' => 140,
    // 508 compliance: add a label, but visually hide it
    '#title' => t('Status'),
    '#title_display' => 'invisible',
    '#default_value' => $default,
    '#attributes' => array('class' => array('statuses-text', 'statuses-text-main')),
    '#resizable' => FALSE,
    '#prefix' => '<div class="statuses-textarea-wrapper">',
    '#suffix' => '</div>',
    '#weight' => -40,

1 Answer 1


Regarding your 2nd and 3rd questions, you could try this answer here: https://drupal.stackexchange.com/a/62407/12701

Instead of hacking the statuses module, you should create your own module and use hook_form_alter() like this:

 * Implements hook_form_alter().
 * Adding WYSIWYG editor to statuses
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'statuses_box':
      $form['fbss-status']['#type'] = 'text_format';
      $form['fbss-status']['#format'] = 'filtered_html';
    case 'fbss_comments_edit':
      $form['status-comment-edit']['#type'] = 'text_format';
      $form['status-comment-edit']['#format'] = 'filtered_html';
  if (substr($form_id, 0, strlen('fbss_comments_box')) === 'fbss_comments_box') {
    $form['status-comment']['#type'] = 'text_format';
    $form['status-comment']['#format'] = 'filtered_html';
  • Your code worked perfectly. How I can attach a user field with this form? It is a link field and I will be using oembed formatter for this field. When user shares the link with statuses, it will be converted to oembed. Then I will create a list of statuses containing these links via views. Currently, I have oembed filter enabled in one of text formats but this way I cannot show it in views.
    – Umair
    Commented May 26, 2017 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.