3 namespace Drupal\plugin_test\Plugin\plugin_test\mock_block;
6 * Mock implementation of a menu block plugin used by Plugin API unit tests.
8 * @see \Drupal\plugin_test\Plugin\MockBlockManager
13 * The title to display when rendering this block instance.
20 * The number of menu levels deep to render.
26 public function __construct($title = '', $depth = 0) {
27 $this->title = $title;
28 $this->depth = $depth;
32 * Returns the content to display.
34 public function getContent() {
35 // Since this is a mock object, we just return some HTML of the desired
36 // nesting level. For depth=2, this returns:
37 // '<ul><li>1<ul><li>1.1</li></ul></li></ul>'.
39 for ($i = 0; $i < $this->depth; $i++) {
40 $content .= '<ul><li>' . implode('.', array_fill(0, $i + 1, '1'));
42 for ($i = 0; $i < $this->depth; $i++) {
43 $content .= '</li></ul>';