drowl_paragraphs_bs-1.x-dev/modules/drowl_paragraphs_bs_type_block_content/drowl_paragraphs_bs_type_block_content.module

modules/drowl_paragraphs_bs_type_block_content/drowl_paragraphs_bs_type_block_content.module
<?php

/**
 * @file
 * Drowl_paragraphs_bs_type_block_content module.
 */

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;

/**
 * Implements hook_form_layout_paragraphs_component_form_alter().
 */
function drowl_paragraphs_bs_type_block_content_form_layout_paragraphs_component_form_alter(array &$form, FormStateInterface &$form_state) {
  if (!empty($form['#paragraph']) && $form['#paragraph']->bundle() == 'block_content') {
    $form['block_content_library'] = [
      '#title' => t('Custom block library'),
      '#type' => 'link',
      '#attributes' => [
        'class' => ['button', 'button--small', 'button--block-content-library'],
        'target' => '_blank',
      ],
      '#url' => Url::fromRoute('entity.block_content.collection'),
    ];
    $form['block_content_add_page'] = [
      '#title' => t('Add custom block'),
      '#type' => 'link',
      '#attributes' => [
        'class' => ['button', 'button--action', 'button--small', 'button--block-content-add-page'],
        'target' => '_blank',
      ],
      '#url' => Url::fromRoute('block_content.add_page'),
    ];
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc