Allow FAPI forms to trigger Better Formats programmatically

Created on 20 January 2017, almost 8 years ago
Updated 30 January 2023, almost 2 years ago

Problem/Motivation

Better Formats currently only works with Fields.

Proposed resolution

Allow developers to trigger Better Formats hiding of format options when creating custom forms using Drupal's form API.

Remaining tasks

Unknown.

User interface changes

None.

API changes

   You are able to trigger Better Formats programatically on custom forms built
   with the form API:

      function my_example_form($form, &$form_state) {
         $form = array();
         $form['example_text_field'] = array(
           '#title' => 'Contribution message ',
           '#type' => 'text_format',
           '#format' => 'teaser_text',
         );
         $form['example_text_field']['better_formats'] = array(
           '#show_selection' => FALSE,
           '#show_tips' => FALSE,
           '#show_tips_link' => FALSE,
         );
         return $form;
      }

Data model changes

None.

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jstoller

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024