You are here

function flag_flag::new_flagging in Flag 7.3

Construct a new, empty flagging entity object.

Parameters

mixed $entity_id: The unique identifier of the object being flagged.

int $uid: (optional) The user id of the user doing the flagging.

mixed $sid: (optional) The user SID (provided by Session API) who is doing the flagging. The SID is 0 for logged in users.

Return value

stdClass The returned object has at least the 'flag_name' property set, which enables Field API to figure out the bundle, but it's your responsibility to eventually populate 'entity_id' and 'flagging_id'.

1 call to flag_flag::new_flagging()
flag_flag::flag in includes/flag/flag_flag.inc
Flags, or unflags, an item.

File

includes/flag/flag_flag.inc, line 973
Contains the flag_flag class. Flag type classes use an object oriented style inspired by that of Views 2.

Class

flag_flag
This abstract class represents a flag, or, in Views 2 terminology, "a handler".

Code

function new_flagging($entity_id = NULL, $uid = NULL, $sid = NULL) {
  return (object) array(
    'flagging_id' => NULL,
    'flag_name' => $this->name,
    'fid' => $this->fid,
    'entity_type' => $this->entity_type,
    'entity_id' => $entity_id,
    'uid' => $uid,
    'sid' => $sid,
  );
}