LayoutDefault example

'library' => 'field_layout/drupal.layout.twocol',
      'theme_hook' => 'layout__twocol',
      'regions' => [
        'left' => [
          'label' => 'Left',
        ],
        'right' => [
          'label' => 'Right',
        ],
      ],
    ]);
    $this->layoutPlugin = new LayoutDefault([], 'two_column', $this->pluginDefinition);

    $this->layoutPluginManager = $this->prophesize(LayoutPluginManagerInterface::class);
    $this->layoutPluginManager->getDefinition('unknown', FALSE)->willReturn(NULL);
    $this->layoutPluginManager->getDefinition('two_column', FALSE)->willReturn($this->pluginDefinition);

    $this->entityFieldManager = $this->prophesize(EntityFieldManagerInterface::class);

    $this->fieldLayoutBuilder = new FieldLayoutBuilder($this->layoutPluginManager->reveal()$this->entityFieldManager->reveal());
  }

  /** * @covers ::buildView * @covers ::getFields */
'label' => '',
      ],
      '#layout' => $definition,
      '#theme' => 'layout',
      '#attached' => [
        'library' => [
          'core/drupal',
        ],
      ],
    ];

    $layout = new LayoutDefault([], '', $definition);
    $this->assertSame($expected$layout->build($regions));
  }

  /** * Provides test data for ::testBuild(). */
  public function providerTestBuild() {
    $data = [];
    // Empty regions are not added.     $data['right_only'] = [
      [
        
Home | Imprint | This part of the site doesn't use cookies.