1 layout_renderer_editor.inc protected LayoutRendererEditor::getBlockLinks($block)

Render the links to display when editing a block.

File

core/modules/layout/plugins/renderers/layout_renderer_editor.inc, line 204
Class file to control the main Layout editor.

Class

LayoutRendererEditor

Code

protected function getBlockLinks($block) {
  $links = array();

  // Only render the "Configure" link if the block is not broken.
  if (!is_a($block, 'BlockBroken')) {
    $links['configure'] = array(
      'title' => t('Configure'),
      'href' => $this->getUrl('configure-block', $block->uuid),
      'attributes' => array(
        'class' => array('use-ajax'),
        'data-dialog' => TRUE,
        'data-dialog-options' => json_encode(array('dialogClass' => 'layout-dialog')),
      ),
    );
  }

  if ($block->module == 'system' && $block->delta == 'page_components' && ($block->childDelta == 'title' || $block->childDelta == 'title_combo')) {
    $links['title'] = array(
      'title' => t('Page title settings'),
      'href' => $this->getUrl('edit-title', 'title'),
      'attributes' => array(
        'class' => array('use-ajax'),
        'data-dialog' => TRUE,
        'data-dialog-options' => json_encode(array('dialogClass' => 'layout-dialog')),
      ),
    );
  }

  $links['remove'] = array(
    'title' => t('Remove'),
    'href' => $this->getUrl('remove-block', $block->uuid),
    'query' => array('token' => backdrop_get_token('layout-' . $this->layout->name)),
    'attributes' => array(
      'class' => array('remove-block', 'use-ajax'),
    ),
  );

  $dropbutton = array(
    '#type' => 'dropbutton',
    '#links' => $links,
  );

  return backdrop_render($dropbutton);
}