public function DeactivateConnection::execute in RedHen CRM 8
Executes the plugin.
Overrides ExecutableInterface::execute
File
- modules/
redhen_connection/ src/ Plugin/ Action/ DeactivateConnection.php, line 22
Class
- DeactivateConnection
- Deactivates a Connection.
Namespace
Drupal\redhen_connection\Plugin\ActionCode
public function execute($connection = NULL) {
// Skip deactivating the connection if already inactive.
if ($connection !== FALSE && $connection
->isActive()) {
// For efficiency manually save the original account before applying any
// changes.
$connection->original = clone $connection;
$connection
->setActive(FALSE);
$connection
->save();
}
}