Out of page context reaction not working in multiple contexts

Created on 13 April 2016, over 9 years ago
Updated 20 July 2025, 8 days ago

When I have multiple contexts with the out of page context reaction, the reaction is executed only in the first context.
This can be reproduced by adding multiple contexts with the same out of page reaction.

In the following code, is there a reason why we break out of the loop here? Can we remove the break so that the reaction would apply to other contexts that may potentially have the same reaction?

  /**
   * Disable any tags that should be disabled based on context.
   */
  function execute() {
    // Check each currently set context to see if the DFP tag specified by
    // machinename should be displayed or not.
    foreach ($this->get_contexts() as $context_name => $context) {
      if (isset($context->reactions['dfp_outofpage'])) {
        foreach ($context->reactions['dfp_outofpage'] as $key => $value) {
          if (!empty($value)) {
            $this->out_of_page_tags[$key] = $value;
          }
        }
        break;
      }
    }
  }
πŸ› Bug report
Status

Closed: outdated

Version

1.4

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States vadimk

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