X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=ext%2Fsearch%2Fsearch.php;h=45b79b6aa2087fa8ca0d433e8893f5dddc5dea59;hb=2894db8454054d30ee3e597b4d9ddba330b73b6e;hp=7c7f9e1a83eac1135efa45bcabc5d0656253956c;hpb=752d4ee65c8d76843aa046e73979eb4013d916a7;p=civicrm-core.git diff --git a/ext/search/search.php b/ext/search/search.php index 7c7f9e1a83..45b79b6aa2 100644 --- a/ext/search/search.php +++ b/ext/search/search.php @@ -121,8 +121,23 @@ function search_civicrm_entityTypes(&$entityTypes) { } /** - * Implements hook_civicrm_thems(). + * Implements hook_civicrm_themes(). */ function search_civicrm_themes(&$themes) { _search_civix_civicrm_themes($themes); } + +/** + * Implements hook_civicrm_pre(). + */ +function search_civicrm_pre($op, $entity, $id, &$params) { + // Supply default name/label when creating new SearchDisplay + if ($entity === 'SearchDisplay' && $op === 'create') { + if (empty($params['label'])) { + $params['label'] = $params['name']; + } + elseif (empty($params['name'])) { + $params['name'] = \CRM_Utils_String::munge($params['label']); + } + } +}