Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * A handler to provide a field that shows the license type.
- *
- * @ingroup views_field_handlers
- */
- class views_handler_apms_license extends views_handler_field {
- function query() {
- // do nothing -- to override the parent query.
- }
- function option_definition() {
- $options = parent::option_definition();
- // Override the alter text option to always alter the text.
- $options['alter']['contains']['alter_text'] = array('default' => TRUE);
- return $options;
- }
- function options_form(&$form, &$form_state) {
- parent::options_form($form, $form_state);
- // Remove the checkbox
- unset($form['alter']['alter_text']);
- unset($form['alter']['text']['#dependency']);
- unset($form['alter']['text']['#process']);
- }
- function render($values) {
- $user = user_load($values->uid);
- if (isset($user->apms['userLicense'])) {
- return $user->apms['userLicense'] ? t('BASIC') : t('FREE');
- }
- else {
- return NULL;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement