You are here

protected function AdminHelp::custom in Webform CiviCRM Integration 8.5

Get help for a custom field

1 call to AdminHelp::custom()
AdminHelp::getHelpText in src/AdminHelp.php
Get help text for the field.

File

src/AdminHelp.php, line 483
Admin form inline-help.

Class

AdminHelp
Class AdminHelp Adding a function to this class with the same name as a field will magically add pop-up help for that field to the admin form.

Namespace

Drupal\webform_civicrm

Code

protected function custom($param) {
  list(, $id) = explode('_', $param);
  if (!is_numeric($id)) {
    return;
  }
  \Drupal::service('civicrm')
    ->initialize();
  $help = '';
  $info = \Drupal::service('webform_civicrm.utils')
    ->wf_civicrm_api('custom_field', 'getsingle', [
    'id' => $id,
  ]);
  if (!empty($info['help_pre'])) {
    $help .= '<p>' . $info['help_pre'] . '</p>';
  }
  if (!empty($info['help_post'])) {
    $help .= '<p>' . $info['help_post'] . '</p>';
  }
  return $help;
}