You are here

public function context_condition_entity_view_mode::execute in Context entity field 7

Execute.

File

plugins/context_condition_entity_view_mode.inc, line 56
Implement context condiction class for entity view mode.

Class

context_condition_entity_view_mode
Expose entity view mode as a context condition.

Code

public function execute($entity_type, $view_mode) {
  if ($this
    ->condition_used()) {
    foreach ($this
      ->get_contexts() as $context) {
      $settings = $this
        ->fetch_from_context($context, 'values');
      if (in_array("{$entity_type}|{$view_mode}", array_filter(unserialize($settings['entity_type'])))) {
        $this
          ->condition_met($context);
      }
    }
  }
}