You are here

function contextphp_reaction_php::execute in Context PHP 6

Same name and namespace in other branches
  1. 7 plugins/contextphp_reaction_php.inc \contextphp_reaction_php::execute()

File

plugins/contextphp_reaction_php.inc, line 35

Class

contextphp_reaction_php
PHP code as a Context reaction.

Code

function execute() {
  foreach (context_active_contexts() as $context) {
    $options = $this
      ->fetch_from_context($context, 'options');
    if (!empty($options['phpcode'])) {
      $code = '<?php ' . $options['phpcode'] . ' ?>';
      drupal_eval($code);
    }
  }
}