You are here

public function MarkerIconService::getFileUploadHelp in Geofield Map 8.2

Generate File Upload Help Message.

Return value

array The field upload help element.

File

src/Services/MarkerIconService.php, line 422

Class

MarkerIconService
Provides an Icon Managed File Service.

Namespace

Drupal\geofield_map\Services

Code

public function getFileUploadHelp() {
  $element = [
    '#type' => 'html_tag',
    '#tag' => 'div',
    'file_upload_help' => [
      '#theme' => 'file_upload_help',
      '#upload_validators' => $this->fileUploadValidators,
      '#cardinality' => 1,
    ],
    'geofield_map_settings_link' => [
      '#type' => 'html_tag',
      '#tag' => 'div',
      '#value' => $this
        ->t('Customize this in  @geofield_map_settings_page_link', [
        '@geofield_map_settings_page_link' => $this->link
          ->generate('Geofield Map Settings Page', Url::fromRoute('geofield_map.settings')),
      ]),
    ],
    '#attributes' => [
      'style' => [
        'style' => 'font-size:0.9em; color: gray; font-weight: normal',
      ],
    ],
  ];

  // Check and initial setup for SVG file support.
  if (!$this->moduleHandler
    ->moduleExists('svg_image')) {
    $element['svg_support'] = [
      '#type' => 'html_tag',
      '#tag' => 'div',
      '#value' => $this
        ->t('SVG Files support is disabled. Enabled it with @svg_image_link', [
        '@svg_image_link' => $this->link
          ->generate('SVG Image Module', Url::fromUri('https://www.drupal.org/project/svg_image', [
          'absolute' => TRUE,
          'attributes' => [
            'target' => 'blank',
          ],
        ])),
      ]),
    ];
  }
  else {
    $element['svg_support'] = [
      '#type' => 'html_tag',
      '#tag' => 'div',
      '#value' => $this
        ->t('SVG Files support enabled.'),
    ];
  }
  return $element;
}