You are here

current_user.form_entity.inc in Flexiform 7

Contains class for a basic entity getter.

File

includes/form_entity/current_user.form_entity.inc
View source
<?php

/**
 * @file
 *  Contains class for a basic entity getter.
 */

/**
 * Simple form entity for the current user.
 *
 * Note that if the user is logged out the function returns false.
 */
class FlexiformFormEntityCurrentUser extends FlexiformFormEntityBase {

  /**
   * {@inheritdoc}
   */
  public function getEntity() {
    global $user;
    parent::getEntity();
    if ($user->uid == 0) {
      return FALSE;
    }
    return user_load($user->uid);
  }

}

Classes

Namesort descending Description
FlexiformFormEntityCurrentUser Simple form entity for the current user.