Problem/Motivation

Creating a new Markdown text format produced the below error.

Steps to reproduce

  1. On a new site, I logged in as User 1, navigated to Admin->Configuration->Content authoring->Text formats and editors.
  2. I typed "Markdown" for the Name and let it generate the machine name automatically.
  3. For enabled filters I ticked Markdown Easy and Limit allowed HTML tags and correct faulty HTML .
  4. I changed to order to put Markdown first.
  5. Under Markdown settings I changed the flavor to GitHub.
  6. I clicked save, and the error below is displayed. Note that the format does save.
 Warning: Undefined array key "#title" in _markdown_easy_filter_format_form_submit() (line 46 of modules/contrib/markdown_easy/markdown_easy.module).

_markdown_easy_filter_format_form_submit(Array, Object)
call_user_func_array('_markdown_easy_filter_format_form_submit', Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('filter_format_add_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lostcarpark created an issue. See original summary.

lostcarpark’s picture

Issue summary: View changes
keshavv’s picture

I have followed all the steps mentioned, But I cannot reproduce it. In my case the value of #titlefield is present.
There is no error log as well.

ultimike’s picture

@lostcarpark - do you get this error consistently?

Were you testing on a fresh D10 install?

Do you have any other modules enabled that might mess with the $form['#title'] of text format forms?

-mike

lostcarpark’s picture

It was a fresh install of D10 under DDEV.

I think I've figured out how to reproduce:

  1. Go to Text formats and editors.
  2. Add text format.
  3. Under enabled filters check "Markdown Easy" and "Limit allowed HTML tags and correct faulty HTML" (but do not select "Convert line breaks into HTML").
  4. Change order to put Markdown Easy first.
  5. Click "Save configuration".

The error above will be displayed.

Note that in the Markdown Easy description, it says "It is strongly recommended to configure the 'Limit allowed HTML tags and correct faulty HTML' filter so that it runs after this filter", but it doesn't mention "Convert line breaks into HTML". It's only when Markdown Easy is enabled that the message about the other module is shown (and in a warning when the format is saved without it).

If you en

ultimike’s picture

Version: 1.0.0-beta2 » 1.0.x-dev
Status: Active » Needs review

@lostcarpark - I've found and fixed the issue and added a test - want to give this a quick looksie?

thanks,
-mike

lostcarpark’s picture

Repeated the steps in #5, and verified no longer getting error message. Looks good now.

lostcarpark’s picture

Status: Needs review » Reviewed & tested by the community

Also ran tests and verified passing. The change and the new test look good to me. Moving to RTBC.

  • ultimike committed 2fde44f9 on 1.0.x
    Issue #3378342 by ultimike, lostcarpark: Undefined array key "#title"
    
ultimike’s picture

Status: Reviewed & tested by the community » Fixed

Sweet - thanks - merging.

-mike

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ultimike’s picture