<?php

/**
 * @file
 * Functionality for LinkedIn Autofill.
 */

/**
 * Implements hook_theme_registry_alter().
 */
function linkedin_autofill_theme_registry_alter(&$theme_registry) {
  $theme_registry['marketo_form_field']['path'] = drupal_get_path('module', 'linkedin_autofill') . '/templates';
}

/**
 * Implements hook_preprocess_paragraph__marketo_form().
 *
 * {@inheritdoc}
 */
function linkedin_autofill_preprocess_paragraph__marketo_form(&$variables) {
  /* @var \Drupal\paragraphs\Entity\Paragraph $paragraph */
  $paragraph = $variables['paragraph'];

  if ($paragraph->parade_enable_linkedin_autofill->value) {
    // Attach LinkedIn autofill library.
    $variables['#attached']['library'][] = 'linkedin_autofill/vendor.linkedin-autofill';
  }
}
