Follow up of #1947072: Allow linebreaks in table cells (text area).

A start to get WYSIWYG would be:

  $form['input_type'] = array(
    '#type' => 'radios',
    '#title' => t('Input type'),
    '#default_value' => isset($instance['widget']['settings']['input_type']) ? $instance['widget']['settings']['input_type'] : 'textfield',
    '#required' => TRUE,
    '#options' => array(
      'textfield' => t('textfield'),
      'textarea' => t('textarea'),
      'text_format' => t('text_format (wysiwyg)'),
    ),
    '#weight' => 120,
  );

Note 'text_format' => t('text_format (wysiwyg)'),. It would however need additional changes. Furthermore instead of storing only the value of the field it stores an array consisting of 'format' and 'value'. I then requires an is_array() condition throughout the code. Advantage is that the text_format can be set per cell.

Above patch can still be reviewed but only implements a simple textarea, not a WYSIWYG. After implementing that a new issue should be opened specifically asking for the feature request WYSIWYG.

Also probably this existing snippet should be made optional:

    if (module_exists('wysiwyg')) {
      $element['#wysiwyg'] = FALSE;
    }
CommentFileSizeAuthor
#3 wysiwyg-support-2869454-3.patch477 bytescallinmullaney
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lolandese created an issue. See original summary.

lolandese’s picture

Note that this feature request applies on https://www.drupal.org/project/ckeditor, https://www.drupal.org/project/wysiwyg and others.

callinmullaney’s picture

Thanks @lolandese for the code snippet above. I needed this for a composer project I was working on so I converted to a patch.

Matt_TOTW’s picture

Is this something that might still be developed? I'm sorry but I think it's a bit beyond me but I see there has been some progress on a D8 version. Would it be better to continue the issue there as a back-port? https://www.drupal.org/project/tablefield/issues/3076448
Thanks

lolandese’s picture

Hi Matt,

You wrote:

Is this something that might still be developed?

Not by me on the D7 version of the module.

The D7 version is maintained for security fixes and will be until EOL of Drupal 7 core, Drupal 7 core will still be supported until November 2021). Also supplied patches are still accepted if they do not risk breaking existing sites and generate a whole bunch of new issues. That might be the case with the patch supplied here and for the referred D8 patch for that matter. I will review the D8 patch and probably commit that as it seems that WYSIWYG support is a common need.

Thanks for reminding me of the D8 issue, as that one should be pushed forward.

Matt_TOTW’s picture

Thanks for the quick reply. No worries, good luck with the D8 branch.
Cheers