Hey there,

Just wanted to let you all know that I'm playing around with Drupal 8, using the Display Suite Extra to Render Fields as Blocks in different regions, and noticed that Field Groups are not rendering properly when moved into a different region. If I rendered the Field Group in the main Content region, there is no issue and the module works as intended. If I'm missing something, I apologize, but I thought I'd at least bring it to your attention.

Thanks,
Charles Wernlund

Comments

kungfu4 created an issue. See original summary.

weri’s picture

I can confirm this problem, that when fields exposed in a block with display suite, the field groups are not rendered.

weri’s picture

Component: Miscellaneous » Code

I've done some debugging but found not a real solution to provide a patch. Maybe we need an additional alter hook in the display suite.

When I add the field_group_form_pre_render() function in the display suite region block, the field groups are rendered.

From:

class DsRegionBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    $id = $this->getDerivativeId();
    $data = drupal_static('ds_block_region');

    if (!empty($data[$id])) {
      return array(
        '#markup' => drupal_render_children($data[$id]),
      );
    }
    else {
      return array();
    }
  }
}

To (it's a hack to try, but not a real solution):

class DsRegionBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    $id = $this->getDerivativeId();
    $data = drupal_static('ds_block_region');

    if (!empty($data[$id])) {

      $element = field_group_form_pre_render($data[$id]);

      if ($element) {
        return array(
          '#markup' => drupal_render_children($element),
        );
      }
    }
    return array();
  }
}

I was searching for an alter hook before ds block region is rendered, but this seems not be possible with the existing alter hooks.

campbellt_’s picture

Status: Active » Closed (outdated)

Closing due to outdated. Please reopen if still an issue.