You are here

protected function RulesPlugin::ensureNameExists in Rules 7.2

Ensure the configuration has a name. If not, generate one.

2 calls to RulesPlugin::ensureNameExists()
RulesPlugin::returnExport in includes/rules.core.inc
Finalizes the configuration export.
RulesPlugin::save in includes/rules.core.inc
Saves the configuration to the database.

File

includes/rules.core.inc, line 1177
Rules base classes and interfaces needed for any rule evaluation.

Class

RulesPlugin
Base class for rules plugins.

Code

protected function ensureNameExists() {
  if (!isset($this->module)) {
    $this->module = 'rules';
  }
  if (!isset($this->name)) {

    // Find a unique name for this configuration.
    $this->name = $this->module . '_';
    for ($i = 0; $i < 8; $i++) {

      // Alphanumeric name generation.
      $rnd = mt_rand(97, 122);
      $this->name .= chr($rnd);
    }
  }
}