You are here

public function SkinrUIController::performOperation in Skinr 8.2

Performs an operation on the skin entity.

Parameters

\Drupal\skinr\SkinInterface $skin: The skin entity.

string $op: The operation to perform, usually 'enable' or 'disable'.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirect back to the skin listing page.

1 string reference to 'SkinrUIController::performOperation'
skinr_ui.routing.yml in skinr_ui/skinr_ui.routing.yml
skinr_ui/skinr_ui.routing.yml

File

skinr_ui/src/Controller/SkinrUIController.php, line 34
Contains \Drupal\skinr_ui\Controller\SkinrUIController.

Class

SkinrUIController
Returns responses for devel module routes.

Namespace

Drupal\skinr_ui\Controller

Code

public function performOperation(SkinInterface $skin, $op) {
  $skin
    ->{$op}()
    ->save();
  if ($op == 'enable') {
    drupal_set_message($this
      ->t('Skin %label has been enabled.', array(
      '%label' => $skin
        ->label(),
    )));
  }
  elseif ($op == 'disable') {
    drupal_set_message($this
      ->t('Skin %label has been disabled.', array(
      '%label' => $skin
        ->label(),
    )));
  }
  return $this
    ->redirect('skinr_ui.list');
}