Skip to content

Commit

Permalink
VACMS-10089: Rename class property for outreach feature toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
chri5tia committed Oct 5, 2023
1 parent f9e3cae commit 716ad41
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class EntityEventSubscriber implements EventSubscriberInterface {
*
* @var \Drupal\feature_toggle\FeatureStatus
*/
protected featureStatus $feature_status;
protected featureStatus $outreachFeatureToggle;

/**
* Constructs the EventSubscriber object.
Expand All @@ -79,7 +79,7 @@ class EntityEventSubscriber implements EventSubscriberInterface {
public function __construct(UserPermsService $user_perms_service, AccountProxy $account_proxy, FeatureStatus $feature_status) {
$this->userPermsService = $user_perms_service;
$this->currentUser = $account_proxy->getAccount();
$this->feature_status = $feature_status;
$this->outreachFeatureToggle = $feature_status;
}

/**
Expand Down Expand Up @@ -117,7 +117,7 @@ protected function outreachHubOnlyUser(): bool {
*/
public function entityPresave(EntityPresaveEvent $event): void {
$entity = $event->getEntity();
if ($entity instanceof NodeInterface && $this->feature_status->getStatus(self::OUTREACH_FEATURE)) {
if ($entity instanceof NodeInterface && $this->outreachFeatureToggle->getStatus(self::OUTREACH_FEATURE)) {
$this->addToNationalOutreachCalendar($entity);
}
}
Expand Down Expand Up @@ -175,7 +175,7 @@ public function addToNationalOutreachCalendar(NodeInterface $node): void {
* The form array.
*/
public function modifyAddToOutreachCalendarElements(array &$form) :void {
if ($this->outreachHubOnlyUser() && $this->feature_status->getStatus(self::OUTREACH_FEATURE)) {
if ($this->outreachHubOnlyUser() && $this->outreachFeatureToggle->getStatus(self::OUTREACH_FEATURE)) {
// Disable the checkbox.
$form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#disabled'] = TRUE;
// Set the default value of the checkbox.
Expand All @@ -193,7 +193,7 @@ public function modifyAddToOutreachCalendarElements(array &$form) :void {
if (isset($form[self::LISTING_FIELD]['widget']['#options']) && !array_key_exists('_none', $form[self::LISTING_FIELD]['widget']['#options'])) {
$form[self::LISTING_FIELD]['widget']['#options'] = ['_none' => '- Select a value -'] + $form[self::LISTING_FIELD]['widget']['#options'];
}
if (!$this->feature_status->getStatus(self::OUTREACH_FEATURE)) {
if (!$this->outreachFeatureToggle->getStatus(self::OUTREACH_FEATURE)) {
$form[self::PUBLISH_TO_OUTREACH_CAL_FIELD]['#access'] = FALSE;
}
}
Expand Down

0 comments on commit 716ad41

Please sign in to comment.