Skip to content

Commit

Permalink
PseudoConstant - Prevent fatal when entity not available
Browse files Browse the repository at this point in the history
This can happen e.g when Views tries to lookup an option value for a disabled extension.
See civicrm/civicrm-drupal#656 (comment)
  • Loading branch information
colemanw committed Sep 7, 2023
1 parent a6c94a2 commit f16e658
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CRM/Core/PseudoConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ public static function get($daoName, $fieldName, $params = [], $context = NULL)
}

// Core field: load schema
$dao = new $daoName();
$fieldSpec = $dao->getFieldSpec($fieldName);
if (class_exists($daoName)) {
$dao = new $daoName();
$fieldSpec = $dao->getFieldSpec($fieldName);
}

// Return false if field doesn't exist.
if (empty($fieldSpec)) {
Expand Down

0 comments on commit f16e658

Please sign in to comment.