示例#1
0
 /**
  * Add a widget for selecting/editing/creating/copying a profile form
  *
  * @param string $name
  *   HTML form-element name.
  * @param string $label
  *   Printable label.
  * @param string $allowCoreTypes
  *   Only present a UFGroup if its group_type includes a subset of $allowCoreTypes; e.g. 'Individual', 'Activity'.
  * @param string $allowSubTypes
  *   Only present a UFGroup if its group_type is compatible with $allowSubypes.
  * @param array $entities
  * @param bool $default
  *   //CRM-15427.
  */
 public function addProfileSelector($name, $label, $allowCoreTypes, $allowSubTypes, $entities, $default = FALSE, $usedFor = NULL)
 {
     // Output widget
     // FIXME: Instead of adhoc serialization, use a single json_encode()
     CRM_UF_Page_ProfileEditor::registerProfileScripts();
     CRM_UF_Page_ProfileEditor::registerSchemas(CRM_Utils_Array::collect('entity_type', $entities));
     $this->add('text', $name, $label, array('class' => 'crm-profile-selector', 'data-group-type' => CRM_Core_BAO_UFGroup::encodeGroupType($allowCoreTypes, $allowSubTypes, ';;'), 'data-entities' => json_encode($entities), 'data-default' => $default, 'data-usedfor' => json_encode($usedFor)));
 }