public function GroupRelationBase::getContentTypeConfigId in Group 2.0.x
Returns a safe, unique configuration ID for a group content type.
By default we use GROUP_TYPE_ID-PLUGIN_ID-DERIVATIVE_ID, but feel free to use any other means of identifying group content types.
Please do not return any invalid characters in the ID as it will crash the website. Refer to ConfigBase::validateName() for valid characters.
Return value
string The safe ID to use as the configuration name.
Overrides GroupRelationInterface::getContentTypeConfigId
See also
\Drupal\Core\Config\ConfigBase::validateName()
File
- src/
Plugin/ Group/ Relation/ GroupRelationBase.php, line 166
Class
- GroupRelationBase
- Provides a base class for GroupContentEnabler plugins.
Namespace
Drupal\group\Plugin\Group\RelationCode
public function getContentTypeConfigId() {
$preferred_id = $this
->getGroupTypeId() . '-' . str_replace(':', '-', $this
->getPluginId());
// Return a hashed ID if the readable ID would exceed the maximum length.
if (strlen($preferred_id) > EntityTypeInterface::BUNDLE_MAX_LENGTH) {
$hashed_id = 'group_content_type_' . md5($preferred_id);
$preferred_id = substr($hashed_id, 0, EntityTypeInterface::BUNDLE_MAX_LENGTH);
}
return $preferred_id;
}