Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable allow selecting multiple products #9

Merged

Conversation

tamasd
Copy link
Contributor

@tamasd tamasd commented May 18, 2018

No description provided.

@@ -844,6 +844,8 @@ function template_preprocess_app_credential(array &$variables) {
}
}

$value = (string) $value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it was passed as on object before? Always or sometimes? If sometimes when it was passed as an object instead of a string? Shouldn't this has been fixed there instead of here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes it is an object, sometimes it is a string if I have seen correctly. And on the other side, sometimes it is fine to pass it as an object, sometimes it is not.

That is why I chose this solution, because it is clean and simple.

Copy link
Contributor

@mxr576 mxr576 May 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but the questions is WHY? Why sometimes it is an object? If it is an object then should not be skipped by default rather? Casting to string is not always the best solution especially if the object does not support that.
Probably the date object properties (expiresAt, issuedAt) causing this, otherwise I would bet for the attributes property which is also an object.

Copy link
Contributor

@mxr576 mxr576 May 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't you catch in which conditions exactly the $value is an object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is not catchable. What happens is that the TranslatableMarkup object will get passed to htmlspecialchars() (IIRC, or a similar funciton) and then I get a warning.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see now. Please add a comment about this above the line and then I can accept this PR.

@@ -90,6 +91,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'checkbox',
'#title' => $this->t('Allow selecting multiple products'),
'#default_value' => $generalConfig->get('multiple_products'),
'#disabled' => !($this->config('apigee_edge.dangerzone')->get('skip_developer_app_settings_validation')) && (bool) DeveloperApp::loadMultiple(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not load all developer apps as object unnecessary. Just get the list of developer app ids.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add a comment to this line that "dangerzone variable" check was only needed to make tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants