You are here

public static function HomeboxPageForm::hideBlockButtons in Homebox 8

Ajax callback to hide block buttons.

Return value

\Drupal\Core\Ajax\AjaxResponse Response to hide buttons.

File

src/Form/HomeboxPageForm.php, line 146

Class

HomeboxPageForm
Class HomeboxPageForm.

Namespace

Drupal\homebox\Form

Code

public static function hideBlockButtons() {
  $response = new AjaxResponse();
  $session = \Drupal::request()
    ->getSession();
  $state = $session
    ->get('block_buttons_visible');
  $response
    ->addCommand(new CssCommand('.block_buttons', [
    'display' => $state ? 'none' : 'block',
  ]));
  $session
    ->set('block_buttons_visible', !$state);
  return $response;
}