Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aws_polly
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
aws_polly
Commits
26472640
Commit
26472640
authored
Apr 6, 2023
by
Augusto Fagioli
Browse files
Options
Downloads
Patches
Plain Diff
fix
#3212580
parent
9f70567b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
aws_polly.module
+17
-37
17 additions, 37 deletions
aws_polly.module
src/Form/AwsPollySettingsForm.php
+1
-1
1 addition, 1 deletion
src/Form/AwsPollySettingsForm.php
with
18 additions
and
38 deletions
aws_polly.module
+
17
−
37
View file @
26472640
...
...
@@ -52,15 +52,13 @@ function aws_polly_help($route_name, RouteMatchInterface $route_match) {
function
aws_polly_node_presave
(
NodeInterface
$node
)
{
$config
=
_validate_aws_configuration
();
if
(
!
$config
)
{
return
;
}
//dump($config);exit;
$ready
=
aws_polly_node_is_ready_for_polly
(
$node
);
if
(
!
$ready
)
{
die
(
"nodo non prnto pe rpolly"
);
return
;
}
if
(
!
$config
)
{
return
;
}
if
(
aws_polly_node_is_ready_for_polly
(
$node
)
==
TRUE
)
{
\Drupal
::
messenger
()
->
addWarning
(
'Audio fields will be processed by AWS Polly'
);
}
// A. Let's polly node title
if
(
\Drupal
::
currentUser
()
->
hasPermission
(
'polly node title'
))
{
...
...
@@ -108,9 +106,7 @@ function aws_polly_add_polly_to_field ( $node, $text, $field_name ) {
return
$node
;
}
// @TODO: add missing voices (anyting via AWS API?)
// @todo add missing voices (anyting via AWS API?)
function
aws_polly_voices
(
$options
)
{
switch
(
$options
[
'language_code'
])
{
...
...
@@ -162,31 +158,15 @@ function _validate_aws_configuration() {
}
function
aws_polly_node_is_ready_for_polly
(
$node
)
{
$ready
=
false
;
$check
=
Array
(
'enabled'
=>
null
,
'has_field'
=>
null
);
$ready
=
FALSE
;
$check
=
[
'enabled'
=>
null
,
'has_field'
=>
null
];
//A node type is enabled
$check
[
'enabled'
]
=
\Drupal
::
state
()
->
get
(
'aws_polly_enabled'
.
$node
->
type
->
entity
->
Id
(),
null
);
// Do we need this check here?
//B Entity has Field check
//B1 Entity has teaser field
//$check['has_field_title'] = $node->hasField('field_' . AWS_POLLY_TITLE_FIELD_NAME);
//B2 Entity has content field
//$check['has_field_content'] = $node->hasField('field_' . AWS_POLLY_CONTENT_FIELD_NAME);
if
(
$check
[
'enabled'
]
==
1
//&& $check['has_field_title'] == true
//&& $check['has_field_content'] == true
)
{
$ready
=
true
;
if
(
$check
[
'enabled'
]
==
1
)
{
$ready
=
TRUE
;
}
return
$ready
;
}
This diff is collapsed.
Click to expand it.
src/Form/AwsPollySettingsForm.php
+
1
−
1
View file @
26472640
...
...
@@ -66,7 +66,7 @@ class AwsPollySettingsForm extends ConfigFormBase {
'#type'
=>
'details'
,
'#title'
=>
$this
->
t
(
'Global Settings'
),
'#description'
=>
$this
->
t
(
'Config applicable through out the site'
),
'#open'
=>
FALS
E
,
'#open'
=>
TRU
E
,
];
// @TODO - be more dynamic here
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment