You are here

class FlagUpdate_2 in Flag 7.3

Flag update class for API 1 flags -> API 2.

The class name after the prefix is immaterial, though we follow the Drupal system update convention whereby the number here is what we update to.

Hierarchy

Expanded class hierarchy of FlagUpdate_2

File

includes/flag.export.inc, line 303
Import/Export functionality provided by Flag module.

View source
class FlagUpdate_2 {

  /**
   * The API version this class updates a flag from.
   *
   * @todo: Change this to a class constant when we drop support for PHP 5.2.
   */
  public $old_api_version = 1;

  /**
   * The API version this class updates a flag to.
   */
  public $new_api_version = 2;

  /**
   * The update function for the flag.
   */
  static function update(&$flag) {
    if (isset($flag->roles) && !isset($flag->roles['flag'])) {
      $flag->roles = array(
        'flag' => $flag->roles,
        'unflag' => $flag->roles,
      );
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FlagUpdate_2::$new_api_version public property The API version this class updates a flag to.
FlagUpdate_2::$old_api_version public property The API version this class updates a flag from.
FlagUpdate_2::update static function The update function for the flag.