In check_markup caching is set to FALSE. Is this for a special reason? It breaks caching for text formats that are used with this boxes content. I have a custom filter that calls out to an external service and the callback is triggered all the time causing lot's of traffic instead of reading the stuff from cache.

I tested with this parameter set to TRUE and could not find any side effects. Can I consider this as a bug?

http://drupalcode.org/project/boxes.git/blob/refs/heads/7.x-1.x:/plugins...

  /**
   * Implementation of boxes_box::render().
   */
  public function render() {
    $content = '';
    if (!empty($this->options['body']['value']) && isset($this->options['body']['format'])) {
      $content = check_markup($this->options['body']['value'], $this->options['body']['format'], $langcode = '' /* TODO Set this variable. */, FALSE);
    }
    $title = isset($this->title) ? $this->title : NULL;
    return array(
      'delta' => $this->delta, // Crucial.
      'title' => $title,
      'subject' => check_plain($title),
      'content' => $content,
    );
  }

check_markup()
http://drupalcode.org/project/drupal.git/blob/refs/heads/7.x:/modules/fi...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Category: support » bug

This does seem a little odd.
Caching of text filter output is a pretty important part of speeding up performance. Having to re-filter text in boxes doesn't seem like a good idea -- let's make this a bug report.

joachim’s picture

Priority: Normal » Major

The docs for https://api.drupal.org/api/drupal/modules!filter!filter.module/function/... say:

$cache: (optional) A Boolean indicating whether to cache the filtered output in the {cache_filter} table. The caller may set this to FALSE when the output is already cached elsewhere to avoid duplicate cache lookups and storage. Defaults to FALSE.

So one could argue that because blocks are cached, there's no need to cache the filtering of the block content.

However, blocks are not always cached. If hook_node_grants() is implemented by anyone, block caching is disabled.

Also, block module itself lets check_markup() cache. So unless there's a very good reason -- and I don't see one -- we should do that too.

joachim’s picture

Status: Active » Needs review
FileSize
745 bytes