Commit | Line | Data |
---|---|---|
7f254ad8 | 1 | <?php |
5a920362 | 2 | /* |
3 | +--------------------------------------------------------------------+ | |
7f254ad8 | 4 | | CiviCRM version 4.6 | |
5a920362 | 5 | +--------------------------------------------------------------------+ |
6 | | This file is a part of CiviCRM. | | |
7 | | | | |
8 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
9 | | under the terms of the GNU Affero General Public License | | |
10 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
11 | | | | |
12 | | CiviCRM is distributed in the hope that it will be useful, but | | |
13 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
14 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
15 | | See the GNU Affero General Public License for more details. | | |
16 | | | | |
17 | | You should have received a copy of the GNU Affero General Public | | |
18 | | License and the CiviCRM Licensing Exception along | | |
19 | | with this program; if not, contact CiviCRM LLC | | |
20 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
21 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
22 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
23 | +--------------------------------------------------------------------+ | |
24 | */ | |
25 | ||
7f254ad8 AE |
26 | /** |
27 | * Field handler to provide acess control for an "pseudo constant / option value" pair | |
28 | * | |
29 | * @ingroup civicrm_field_handlers | |
30 | */ | |
31 | class civicrm_handler_field_option extends civicrm_handler_field { | |
32 | static $_options; | |
33 | function render($values) { | |
34 | $this->initialize(); | |
5a920362 | 35 | |
7f254ad8 AE |
36 | $id = $values->{$this->field_alias}; |
37 | if (empty($id) || | |
38 | (int ) $id <= 0 | |
39 | ) { | |
40 | return NULL; | |
41 | } | |
5a920362 | 42 | |
7f254ad8 AE |
43 | return self::$_options[$values->{$this->field_alias}]; |
44 | } | |
5a920362 | 45 | } |
7f254ad8 AE |
46 | |
47 |