getSavedOptions('access_code'); $value = (string) $value; $label = '"Status". '; Log::info($access_code); if( $value === 'disabled' ) { return $value; } elseif ( $value === 'enabled' ) { if( $access_code !== '' && preg_match('/^[A-Za-z0-9]{3,12}$/', $access_code) ) { return $value; } else { return $this->failureMessage($label . 'For Enabled status to be selected the Access Code must contain a valid value.'); } } return $this->failureMessage($label . 'Value must be Enabled or Disabled.'); } protected function access_code( $value ) { $status = $this->getSavedOptions('status'); $value = (string) $value; $label = '"Access Code". '; if( $status === 'disabled' ) { if ( $value === '' || preg_match('/^[A-Za-z0-9]{3,12}$/', $value) ) { return $value; } } elseif ( $status === 'enabled' ) { if( $value === '' ) { return $this->failureMessage($label . 'A valid code is required when Enabled status is selected.'); } if ( preg_match('/^[A-Za-z0-9]{3,12}$/', $value) ) { return $value; } } return $this->failureMessage($label . 'Value can only contain characters A-Z and 0-9 with a length between 3-12 characters.'); } protected function access_persistence( $value ) { $value = (string) $value; $label = '"Access Persistence". '; if( $value === 'session' ) { return $value; } return $this->failureMessage($label . 'The only valid selection is Session.'); } }