*/
trait CRM_Core_Form_EntityFormTrait {
+ /**
+ * The id of the object being edited / created.
+ *
+ * @var int
+ */
+ public $_id;
+
/**
* The entity subtype ID (eg. for Relationship / Activity)
*
* @var int
*/
- protected $_entitySubTypeId;
+ protected $_entitySubTypeId = NULL;
/**
* Get entity fields for the entity to be added to the form.
return $this->_id;
}
+ /**
+ * Set the entity ID
+ *
+ * @param int $id The entity ID
+ */
+ public function setEntityId($id) {
+ $this->_id = $id;
+ }
+
/**
* Should custom data be suppressed on this form.
*
/**
* Get the entity subtype ID being edited
*
- * @param $subTypeId
- *
* @return int|null
*/
- public function getEntitySubTypeId($subTypeId) {
- if ($subTypeId) {
- return $subTypeId;
- }
+ public function getEntitySubTypeId() {
return $this->_entitySubTypeId;
}
+ /**
+ * Set the entity subtype ID being edited
+ *
+ * @param $subTypeId
+ */
+ public function setEntitySubTypeId($subTypeId) {
+ $this->_entitySubTypeId = $subTypeId;
+ }
+
/**
* If the custom data is in the submitted data (eg. added via ajax loaded form) add to form.
*/
}
$customisableEntities = CRM_Core_SelectValues::customGroupExtends();
if (isset($customisableEntities[$this->getDefaultEntity()])) {
- CRM_Custom_Form_CustomData::addToForm($this);
+ CRM_Custom_Form_CustomData::addToForm($this, $this->getEntitySubTypeId());
}
}