View source
<?php
namespace Drupal\lingotek\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\lingotek\LingotekIntelligenceMetadataInterface;
use Drupal\lingotek\LingotekProfileInterface;
class LingotekProfile extends ConfigEntityBase implements LingotekProfileInterface, LingotekIntelligenceMetadataInterface {
protected $id;
protected $label;
protected $weight = 0;
protected $locked = FALSE;
protected $auto_upload = FALSE;
protected $auto_request = FALSE;
protected $auto_download = FALSE;
protected $auto_download_worker = FALSE;
protected $vault = 'default';
protected $filter = 'drupal_default';
protected $subfilter = 'drupal_default';
protected $project = 'default';
protected $workflow = 'default';
protected $language_overrides = [];
protected $append_type_to_title = 'global_setting';
protected $intelligence_metadata = [
'override' => FALSE,
'business_unit' => '',
'business_division' => '',
'campaign_id' => '',
'campaign_rating' => 0,
'channel' => '',
'contact_name' => '',
'contact_email' => '',
'content_description' => '',
'external_style_id' => '',
'purchase_order' => '',
'region' => '',
'use_author' => TRUE,
'default_author_email' => '',
'use_author_email' => TRUE,
'use_contact_email_for_author' => FALSE,
'use_business_unit' => TRUE,
'use_business_division' => TRUE,
'use_campaign_id' => TRUE,
'use_campaign_rating' => TRUE,
'use_channel' => TRUE,
'use_contact_name' => TRUE,
'use_contact_email' => TRUE,
'use_content_description' => TRUE,
'use_external_style_id' => TRUE,
'use_purchase_order' => TRUE,
'use_region' => TRUE,
'use_base_domain' => TRUE,
'use_reference_url' => TRUE,
];
public function __construct(array $values, $entity_type) {
if (isset($values['intelligence_metadata']) && is_array($values['intelligence_metadata'])) {
$values['intelligence_metadata'] += $this->intelligence_metadata;
}
return parent::__construct($values, $entity_type);
}
public function getBusinessUnit() {
return $this->intelligence_metadata['business_unit'];
}
public function setBusinessUnit($business_unit) {
$this->intelligence_metadata['business_unit'] = $business_unit;
return $this;
}
public function getBusinessDivision() {
return $this->intelligence_metadata['business_division'];
}
public function setBusinessDivision($business_division) {
$this->intelligence_metadata['business_division'] = $business_division;
return $this;
}
public function getCampaignId() {
return $this->intelligence_metadata['campaign_id'];
}
public function setCampaignId($campaign_id) {
$this->intelligence_metadata['campaign_id'] = $campaign_id;
return $this;
}
public function getCampaignRating() {
return $this->intelligence_metadata['campaign_rating'];
}
public function setCampaignRating($campaign_rating) {
$this->intelligence_metadata['campaign_rating'] = $campaign_rating;
return $this;
}
public function getChannel() {
return $this->intelligence_metadata['channel'];
}
public function setChannel($channel) {
$this->intelligence_metadata['channel'] = $channel;
return $this;
}
public function getContactName() {
return $this->intelligence_metadata['contact_name'];
}
public function setContactName($contact_name) {
$this->intelligence_metadata['contact_name'] = $contact_name;
return $this;
}
public function getContactEmail() {
return $this->intelligence_metadata['contact_email'];
}
public function setContactEmail($contact_email) {
$this->intelligence_metadata['contact_email'] = $contact_email;
return $this;
}
public function getContentDescription() {
return $this->intelligence_metadata['content_description'];
}
public function setContentDescription($content_description) {
$this->intelligence_metadata['content_description'] = $content_description;
return $this;
}
public function getPurchaseOrder() {
return $this->intelligence_metadata['purchase_order'];
}
public function setPurchaseOrder($purchase_order) {
$this->intelligence_metadata['purchase_order'] = $purchase_order;
return $this;
}
public function getExternalStyleId() {
return $this->intelligence_metadata['external_style_id'];
}
public function setExternalStyleId($external_style_id) {
$this->intelligence_metadata['external_style_id'] = $external_style_id;
return $this;
}
public function getRegion() {
return $this->intelligence_metadata['region'];
}
public function setRegion($region) {
$this->intelligence_metadata['region'] = $region;
return $this;
}
public function getAuthorPermission() {
return $this->intelligence_metadata['use_author'];
}
public function setAuthorPermission($use_author) {
$this->intelligence_metadata['use_author'] = $use_author;
return $this;
}
public function getDefaultAuthorEmail() {
return $this->intelligence_metadata['default_author_email'];
}
public function setDefaultAuthorEmail($default_author_email) {
$this->intelligence_metadata['default_author_email'] = $default_author_email;
return $this;
}
public function getAuthorEmailPermission() {
return $this->intelligence_metadata['use_author_email'];
}
public function setAuthorEmailPermission($use_author_email) {
$this->intelligence_metadata['use_author_email'] = $use_author_email;
return $this;
}
public function getContactEmailForAuthorPermission() {
return $this->intelligence_metadata['use_contact_email_for_author'];
}
public function setContactEmailForAuthorPermission($use_contact_email_for_author) {
$this->intelligence_metadata['use_contact_email_for_author'] = $use_contact_email_for_author;
return $this;
}
public function getBusinessUnitPermission() {
return $this->intelligence_metadata['use_business_unit'];
}
public function setBusinessUnitPermission($use_business_unit) {
$this->intelligence_metadata['use_business_unit'] = $use_business_unit;
return $this;
}
public function getBusinessDivisionPermission() {
return $this->intelligence_metadata['use_business_division'];
}
public function setBusinessDivisionPermission($use_business_division) {
$this->intelligence_metadata['use_business_division'] = $use_business_division;
return $this;
}
public function getCampaignIdPermission() {
return $this->intelligence_metadata['use_campaign_id'];
}
public function setCampaignIdPermission($use_campaign_id) {
$this->intelligence_metadata['use_campaign_id'] = $use_campaign_id;
return $this;
}
public function getCampaignRatingPermission() {
return $this->intelligence_metadata['use_campaign_rating'];
}
public function setCampaignRatingPermission($use_campaign_rating) {
$this->intelligence_metadata['use_campaign_rating'] = $use_campaign_rating;
return $this;
}
public function getChannelPermission() {
return $this->intelligence_metadata['use_channel'];
}
public function setChannelPermission($use_channel) {
$this->intelligence_metadata['use_channel'] = $use_channel;
return $this;
}
public function getContactNamePermission() {
return $this->intelligence_metadata['use_contact_name'];
}
public function setContactNamePermission($use_contact_name) {
$this->intelligence_metadata['use_contact_name'] = $use_contact_name;
return $this;
}
public function getContactEmailPermission() {
return $this->intelligence_metadata['use_contact_email'];
}
public function setContactEmailPermission($use_contact_email) {
$this->intelligence_metadata['use_contact_email'] = $use_contact_email;
return $this;
}
public function getContentDescriptionPermission() {
return $this->intelligence_metadata['use_content_description'];
}
public function setContentDescriptionPermission($use_content_description) {
$this->intelligence_metadata['use_content_description'] = $use_content_description;
return $this;
}
public function getExternalStyleIdPermission() {
return $this->intelligence_metadata['use_external_style_id'];
}
public function setExternalStyleIdPermission($use_external_style_id) {
$this->intelligence_metadata['use_external_style_id'] = $use_external_style_id;
return $this;
}
public function getPurchaseOrderPermission() {
return $this->intelligence_metadata['use_purchase_order'];
}
public function setPurchaseOrderPermission($use_purchase_order) {
$this->intelligence_metadata['use_purchase_order'] = $use_purchase_order;
return $this;
}
public function getRegionPermission() {
return $this->intelligence_metadata['use_region'];
}
public function setRegionPermission($use_region) {
$this->intelligence_metadata['use_region'] = $use_region;
return $this;
}
public function getBaseDomainPermission() {
return $this->intelligence_metadata['use_base_domain'];
}
public function setBaseDomainPermission($use_base_domain) {
$this->intelligence_metadata['use_base_domain'] = $use_base_domain;
return $this;
}
public function getReferenceUrlPermission() {
return $this->intelligence_metadata['use_reference_url'];
}
public function setReferenceUrlPermission($use_reference_url) {
$this->intelligence_metadata['use_reference_url'] = $use_reference_url;
return $this;
}
public function isLocked() {
return (bool) $this->locked;
}
public function getAppendContentTypeToTitle() {
return $this->append_type_to_title;
}
public function setAppendContentTypeToTitle($append_type_to_title = 'global_setting') {
$this->append_type_to_title = $append_type_to_title;
return $this;
}
public function getWeight() {
return $this->weight;
}
public function setWeight($weight) {
$this->weight = $weight;
return $this;
}
public function hasAutomaticUpload() {
return (bool) $this->auto_upload;
}
public function setAutomaticUpload($auto_upload) {
$this->auto_upload = $auto_upload;
return $this;
}
public function hasAutomaticDownloadWorker() {
return (bool) $this->auto_download_worker;
}
public function setAutomaticDownloadWorker($auto_download_worker) {
$this->auto_download_worker = $auto_download_worker;
return $this;
}
public function hasAutomaticRequest() {
return (bool) $this->auto_request;
}
public function setAutomaticRequest($auto_request) {
$this->auto_request = $auto_request;
return $this;
}
public function hasAutomaticDownload() {
return (bool) $this->auto_download;
}
public function setAutomaticDownload($auto_download) {
$this->auto_download = $auto_download;
return $this;
}
public function getVault() {
return $this->vault;
}
public function setVault($vault) {
$this->vault = $vault;
return $this;
}
public function getFilter() {
return $this->filter;
}
public function setFilter($filter) {
$this->filter = $filter;
return $this;
}
public function getSubfilter() {
return $this->subfilter;
}
public function setSubfilter($filter) {
$this->subfilter = $filter;
return $this;
}
public function getProject() {
return $this->project;
}
public function setProject($project) {
$this->project = $project;
return $this;
}
public function getWorkflow() {
return $this->workflow;
}
public function setWorkflow($workflow) {
$this->workflow = $workflow;
return $this;
}
public function getWorkflowForTarget($langcode) {
$workflow = $this
->getWorkflow();
if (isset($this->language_overrides[$langcode]) && $this
->hasCustomSettingsForTarget($langcode)) {
$workflow = $this->language_overrides[$langcode]['custom']['workflow'];
}
return $workflow;
}
public function setWorkflowForTarget($langcode, $value) {
$this->language_overrides[$langcode]['custom']['workflow'] = $value;
return $this;
}
public function hasAutomaticRequestForTarget($langcode) {
$auto_request = $this
->hasAutomaticRequest();
if (isset($this->language_overrides[$langcode]) && $this
->hasCustomSettingsForTarget($langcode)) {
$auto_request = $this->language_overrides[$langcode]['custom']['auto_request'];
}
return $auto_request;
}
public function setAutomaticRequestForTarget($langcode, $value) {
$this->language_overrides[$langcode]['custom']['auto_request'] = $value;
return $this;
}
public function hasAutomaticDownloadForTarget($langcode) {
$auto_download = $this
->hasAutomaticDownload();
if (isset($this->language_overrides[$langcode]) && $this
->hasCustomSettingsForTarget($langcode)) {
$auto_download = $this->language_overrides[$langcode]['custom']['auto_download'];
}
return $auto_download;
}
public function setAutomaticDownloadForTarget($langcode, $value) {
$this->language_overrides[$langcode]['custom']['auto_download'] = $value;
return $this;
}
public function hasCustomSettingsForTarget($langcode) {
return isset($this->language_overrides[$langcode]) && $this->language_overrides[$langcode]['overrides'] === 'custom';
}
public function hasIntelligenceMetadataOverrides() {
return isset($this->intelligence_metadata['override']) && $this->intelligence_metadata['override'] === TRUE;
}
public function setIntelligenceMetadataOverrides($value) {
$this->intelligence_metadata['override'] = $value;
return $this;
}
public function getVaultForTarget($langcode) {
$vault = $this
->getVault();
if (isset($this->language_overrides[$langcode]) && $this
->hasCustomSettingsForTarget($langcode)) {
$vault = $this->language_overrides[$langcode]['custom']['vault'];
}
return $vault;
}
public function setVaultForTarget($langcode, $value) {
$this->language_overrides[$langcode]['custom']['vault'] = $value;
return $this;
}
}