You are here

function flag_flag::insert in Flag 7.2

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.3 includes/flag/flag_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 ./flag.inc
Saves a flag to the database. It is a wrapper around update() and insert().

File

./flag.inc, line 1134
Implements various flags. Uses 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('flags')
    ->fields(array(
    'content_type' => $this->content_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();
  }
}