You are here

function flag_flag::insert in Flag 7.3

Same name and namespace in other branches
  1. 5 flag.inc \flag_flag::insert()
  2. 6.2 flag.inc \flag_flag::insert()
  3. 6 flag.inc \flag_flag::insert()
  4. 7.2 flag.inc \flag_flag::insert()

Saves a new flag to the database. Better use save().

1 call to flag_flag::insert()
flag_flag::save in includes/flag/flag_flag.inc
Saves a flag to the database. It is a wrapper around update() and insert().

File

includes/flag/flag_flag.inc, line 1387
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 insert() {
  $this->fid = db_insert('flag')
    ->fields(array(
    'entity_type' => $this->entity_type,
    'name' => $this->name,
    'title' => $this->title,
    'global' => $this->global,
    'options' => $this
      ->get_serialized_options(),
  ))
    ->execute();
  foreach ($this->types as $type) {
    db_insert('flag_types')
      ->fields(array(
      'fid' => $this->fid,
      'type' => $type,
    ))
      ->execute();
  }
}