Content Hub

Using blocks with Content Hub 1.x

Important

Content Hub 1.x will reach end-of-life on September 30, 2024. Acquia recommends you to upgrade to Content Hub 3.x. For more information, see Upgrading from Content Hub 1.x to 3.x.

Drupal uses blocks for specific layout needs, which Content Hub can take advantage of for syndicating content.

Enabling View mode for custom blocks

Custom blocks do not, by default, have a View mode available to Content Hub. To enable one, complete the following steps:

  1. Sign in to your website as an administrator.
  2. In the admin menu, click Structure, and then click the Block layout link.
  3. Click the Custom block library tab.
  4. Find the custom block that you want to share, and in the Operations column, click Manage display from the custom block’s menu of operations.
  5. Click Custom display settings, and then select the Full check box and any other view modes that you may want to use.
  6. Click Save.

The selected view modes for your block should now be visible on the Entity Configuration page.

Theming a custom block

By default, the current Drupal version does not provide a custom theme hook for block entities. If you want to share content using a custom theme template, Content Hub provides a hook which can be used to style blocks as they are imported into Content Hub.

Note

Acquia recommends that the Content Hub theme template remain identical to the block’s original theme template to maintain styling consistency.

The following steps outline how to apply a custom theme template to block entities shared using Content Hub:

  1. Copy the /core/modules/block/templates/block.html.twig file into the templates/block/ folder inside the website’s default theme.
  2. Rename the copied file to block--block-content--acquia-contenthub.html.twig
  3. Rebuild the website cache.
  4. Use the following Drush command to enable block content view builder for block rendering, which allows Content Hub to use the new theme template that you created:

    drush cset acquia_contenthub.entity_config use_block_content_view_builder true
    
  5. To disable block content view builder and stop Content Hub from using the theme template, use the following command:

    drush cset acquia_contenthub.entity_config use_block_content_view_builder 0