You are here

class LockFormCommand in Content locking (anti-concurrent editing) 8

Same name and namespace in other branches
  1. 8.2 src/Ajax/LockFormCommand.php \Drupal\content_lock\Ajax\LockFormCommand

Defines an AJAX command to lock current form.

Hierarchy

Expanded class hierarchy of LockFormCommand

1 file declares its use of LockFormCommand
ContentLockController.php in src/Controller/ContentLockController.php

File

src/Ajax/LockFormCommand.php, line 12

Namespace

Drupal\content_lock\Ajax
View source
class LockFormCommand implements CommandInterface {
  protected $lockable;
  protected $lock;

  /**
   * LockFormCommand constructor.
   *
   * @param bool $lockable
   * @param bool $lock
   */
  public function __construct($lockable = FALSE, $lock = FALSE) {
    $this->lockable = $lockable;
    $this->lock = $lock;
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      'command' => 'lockForm',
      'selector' => '',
      'lockable' => $this->lockable,
      'lock' => $this->lock,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LockFormCommand::$lock protected property
LockFormCommand::$lockable protected property
LockFormCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
LockFormCommand::__construct public function LockFormCommand constructor.