function flag_flag::revert in Flag 7.3
Same name and namespace in other branches
- 6.2 flag.inc \flag_flag::revert()
- 7.2 flag.inc \flag_flag::revert()
Reverts an overriding flag to its default state.
Note that $this isn't altered. To see the reverted flag you'll have to call flag_get_flag($this->name) again.
Return value
TRUE if the flag was reverted successfully; FALSE if there was an error; NULL if this flag overrides no default flag.
File
- includes/
flag/ flag_flag.inc, line 1481 - 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 revert() {
if ($default_flag = $this
->find_default_flag()) {
if ($default_flag
->is_compatible()) {
$default_flag = clone $default_flag;
$default_flag->fid = $this->fid;
$default_flag
->save();
drupal_static_reset('flag_get_flags');
return TRUE;
}
else {
return FALSE;
}
}
}