"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/lib/Drupal/Core/Ajax/RemoveCommand.php" (26 Nov 2020, 981 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "RemoveCommand.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\Core\Ajax;
    4 
    5 /**
    6  * AJAX command for calling the jQuery remove() method.
    7  *
    8  * The 'remove' command instructs the client to use jQuery's remove() method
    9  * to remove each of elements matched by the given selector, and everything
   10  * within them.
   11  *
   12  * This command is implemented by Drupal.AjaxCommands.prototype.remove()
   13  * defined in misc/ajax.js.
   14  *
   15  * @see http://docs.jquery.com/Manipulation/remove#expr
   16  *
   17  * @ingroup ajax
   18  */
   19 class RemoveCommand implements CommandInterface {
   20 
   21   /**
   22    * The CSS selector for the element(s) to be removed.
   23    *
   24    * @var string
   25    */
   26   protected $selector;
   27 
   28   /**
   29    * Constructs a RemoveCommand object.
   30    *
   31    * @param string $selector
   32    */
   33   public function __construct($selector) {
   34     $this->selector = $selector;
   35   }
   36 
   37   /**
   38    * Implements Drupal\Core\Ajax\CommandInterface:render().
   39    */
   40   public function render() {
   41     return [
   42       'command' => 'remove',
   43       'selector' => $this->selector,
   44     ];
   45   }
   46 
   47 }