function RulesPlugin::ensureNameExists

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 1188

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);
        }
    }
}