Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ReplaceTitleCommand.php

class ReplaceTitleCommand

Provides an AJAX command for replacing the page title.

This command is implemented in Drupal.AjaxCommands.prototype.viewsReplaceTitle.

Hierarchy

  • class \Drupal\views\Ajax\ReplaceTitleCommand implements \Drupal\Core\Ajax\CommandInterface

Expanded class hierarchy of ReplaceTitleCommand

1 file declares its use of ReplaceTitleCommand
ViewsFormBase.php in core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php

File

core/modules/views/src/Ajax/ReplaceTitleCommand.php, line 12

Namespace

Drupal\views\Ajax
View source
class ReplaceTitleCommand implements CommandInterface {
    
    /**
     * The page title to replace.
     *
     * @var string
     */
    protected $title;
    
    /**
     * Constructs a \Drupal\views\Ajax\ReplaceTitleCommand object.
     *
     * @param string $title
     *   The title of the page.
     */
    public function __construct($title) {
        $this->title = $title;
    }
    
    /**
     * {@inheritdoc}
     */
    public function render() {
        return [
            'command' => 'viewsReplaceTitle',
            'title' => $this->title,
            'siteName' => \Drupal::config('system.site')->get('name'),
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
ReplaceTitleCommand::$title protected property The page title to replace.
ReplaceTitleCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
ReplaceTitleCommand::__construct public function Constructs a \Drupal\views\Ajax\ReplaceTitleCommand object.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal