You are here

public static function SettingsHelper::getUdfLimitsForType in Acquia Lift Connector 8.4

Same name and namespace in other branches
  1. 8.3 src/Service/Helper/SettingsHelper.php \Drupal\acquia_lift\Service\Helper\SettingsHelper::getUdfLimitsForType()

Returns the list of UDFs that can be mapped to.

Parameters

string $type: The type of UDF field. Can be person, touch or event.

Return value

array An array of possible UDF metatag values for the given type.

Throws

Exception An exception if the type given is not supported.

3 calls to SettingsHelper::getUdfLimitsForType()
AdminSettingsForm::buildUdfMappingsForm in src/Form/AdminSettingsForm.php
Build UDF mappings form.
SettingsHelperTest::testGetUdfLimitsForType in tests/src/Unit/Service/Helper/SettingsHelperTest.php
Tests the getUdfLimitsForType() method.
SettingsHelperTest::testGetUdfLimitsForTypeExpectedException in tests/src/Unit/Service/Helper/SettingsHelperTest.php
Tests the getUdfLimitsForType() method, expected exception.

File

src/Service/Helper/SettingsHelper.php, line 165

Class

SettingsHelper
Defines the Settings Helper class.

Namespace

Drupal\acquia_lift\Service\Helper

Code

public static function getUdfLimitsForType($type = "person") {
  if ($type !== 'person' && $type !== 'touch' && $type !== 'event') {
    throw new Exception('This UDF Field type is not supported.');
  }
  $counts = [
    'person' => 50,
    'touch' => 20,
    'event' => 50,
  ];
  return $counts[$type];
}