og-8.x-1.x-dev/src/OgFieldsInterface.php
src/OgFieldsInterface.php
<?php
declare(strict_types=1);
namespace Drupal\og;
/**
* The OG fields related interface.
*/
interface OgFieldsInterface {
/**
* Set the bundle.
*/
public function setBundle(string $bundle): static;
/**
* Get the bundle name.
*/
public function getBundle(): string;
/**
* Get the entity type name.
*/
public function getEntityType(): string;
/**
* Set the entity type.
*
* @throws \Exception
* Throw error if the field storage config definition explicitly defines to
* which entities the field can be attached to.
*/
public function setEntityType(string $entity_type): static;
/**
* Get the field name.
*/
public function getFieldName(): string;
/**
* Set the field name.
*
* The field name is often the same as the plugin ID, however it is
* overridable. For example, the group audience field is identified as
* \Drupal\og\OgGroupAudienceHelperInterface::DEFAULT_FIELD, however the
* actual field name attached to the bundle can be arbitrary.
*/
public function setFieldName(string $field_name): static;
/**
* Get the field storage config base definition.
*
* @param array $values
* Values to override the base definitions.
*
* @return array
* Array that will be used as the base values for
* FieldStorageConfig::create().
*/
public function getFieldStorageBaseDefinition(array $values = []): array;
/**
* Get the field config base definition.
*
* @param array $values
* Values to override the base definitions.
*
* @return array
* Array that will be used as the base values for
* FieldConfig::create().
*/
public function getFieldBaseDefinition(array $values = []): array;
/**
* Get the field's form display definition.
*
* @param array $values
* Values to override the base definitions.
*
* @return array
* Array that will be used as the base values for
* FieldConfig::create().
*/
public function getFormDisplayDefinition(array $values = []): array;
/**
* Get the field's view modes definition.
*
* @param array $values
* Values to override the base definitions.
*
* @return array
* Array that will be used as the base values for
* FieldConfig::create().
*/
public function getViewDisplayDefinition(array $values = []): array;
}
