MockMenuBlock.php in Drupal 10
File
core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/mock_block/MockMenuBlock.php
View source
<?php
namespace Drupal\plugin_test\Plugin\plugin_test\mock_block;
class MockMenuBlock {
protected $title;
protected $depth;
public function __construct($title = '', $depth = 0) {
$this->title = $title;
$this->depth = $depth;
}
public function getContent() {
$content = '';
for ($i = 0; $i < $this->depth; $i++) {
$content .= '<ul><li>' . implode('.', array_fill(0, $i + 1, '1'));
}
for ($i = 0; $i < $this->depth; $i++) {
$content .= '</li></ul>';
}
return $content;
}
}
Classes
Name |
Description |
MockMenuBlock |
Mock implementation of a menu block plugin used by Plugin API unit tests. |