Created
January 8, 2015 20:38
-
-
Save marwenblel/8ea9c50a7db6bd4991e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Expose the myfield field value as a context condition. | |
*/ | |
class basedoc_droits_has_corporate_option extends context_condition { | |
/** | |
* condition_values | |
*/ | |
function condition_values() { | |
return array( | |
'no' => t('No'), | |
'yes' => t('Yes'), | |
); | |
} | |
/** | |
* Condition form. | |
*/ | |
function condition_form($context) { | |
$form = parent::condition_form($context); | |
if (variable_get('VXP_institutionnel', TRUE)) { | |
$default = array('no'); | |
} else { | |
$default = array('yes'); | |
} | |
$form['#default_value'] = $default; | |
$form['#disabled'] = TRUE; | |
return $form; | |
} | |
/** | |
* function execute | |
*/ | |
function execute($value) { | |
if (is_array(context_condition_map()['basedoc_droits_has_corporate_option'])) { | |
foreach ($this->get_contexts($value) as $context) { | |
$this->condition_met($context, $value); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment