You are here

private function AdminSettingsForm::buildThumbnailUrlForm in Acquia Lift Connector 8

Display thumbnail URL form.

Return value

array Thumbnail URL form.

1 call to AdminSettingsForm::buildThumbnailUrlForm()
AdminSettingsForm::buildForm in src/Form/AdminSettingsForm.php
Form constructor.

File

src/Form/AdminSettingsForm.php, line 280
Contains \Drupal\acquia_lift\Form\AdminSettingsForm.

Class

AdminSettingsForm
Defines a form that configures settings.

Namespace

Drupal\acquia_lift\Form

Code

private function buildThumbnailUrlForm() {
  $form = [
    '#title' => t('Thumbnail URL'),
    '#type' => 'details',
    '#tree' => TRUE,
    '#group' => 'data_collection_settings',
  ];
  $form['link_list'] = [
    '#type' => 'markup',
    '#markup' => '<div>' . t('There are no content types. Please create a content type first.') . '</div>',
  ];
  $node_types = NodeType::loadMultiple();
  if (empty($node_types)) {
    return $form;
  }
  $links = [];
  $link_attributes = [
    'attributes' => [
      'target' => '_blank',
    ],
    'fragment' => 'edit-acquia-lift',
  ];
  foreach ($node_types as $node_type) {
    $url = Url::fromRoute('entity.node_type.edit_form', [
      'node_type' => $node_type
        ->id(),
    ], $link_attributes);
    $links[] = '<p>' . Link::fromTextAndUrl($node_type
      ->label(), $url)
      ->toString() . '</p>';
  }
  $form['link_list']['#markup'] = t('Configure thumbnail URLs on each content type\'s edit page (in a new window):');
  $form['link_list']['#markup'] .= implode('', $links);
  return $form;
}