Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
captcha
Commits
6d03cad5
Commit
6d03cad5
authored
Oct 16, 2019
by
gg24
Committed by
Fabiano Sant'Ana
Oct 16, 2019
Browse files
Issue #3083298 by ravi.shankar, gg24, wundo: Removing deprecated method file_scan_directory
parent
4c2b00e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
image_captcha/src/Form/ImageCaptchaSettingsForm.php
image_captcha/src/Form/ImageCaptchaSettingsForm.php
+17
-5
No files found.
image_captcha/src/Form/ImageCaptchaSettingsForm.php
View file @
6d03cad5
...
...
@@ -11,6 +11,7 @@ use Drupal\Core\Language\LanguageManagerInterface;
use
Drupal\Core\Template\Attribute
;
use
Drupal\Core\Url
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Drupal\Core\File\FileSystemInterface
;
/**
* Displays the pants settings form.
...
...
@@ -24,17 +25,27 @@ class ImageCaptchaSettingsForm extends ConfigFormBase {
*/
protected
$languageManager
;
/**
* The file_system service.
*
* @var \Drupal\Core\File\FileSystemInterface
*/
protected
$fileSystem
;
/**
* Constructs a \Drupal\image_captcha\Form\ImageCaptchaSettingsForm object.
*
* @param
\Drupal\Core\Config\
ConfigFactoryInterface $config_factory
* @param ConfigFactoryInterface $config_factory
* The factory for configuration objects.
* @param
\Drupal\Core\Language\
LanguageManagerInterface $language_manager
* @param LanguageManagerInterface $language_manager
* The language manager.
* @param FileSystemInterface $fileSystem
* The file_system service.
*/
public
function
__construct
(
ConfigFactoryInterface
$config_factory
,
LanguageManagerInterface
$language_manager
)
{
public
function
__construct
(
ConfigFactoryInterface
$config_factory
,
LanguageManagerInterface
$language_manager
,
FileSystemInterface
$fileSystem
)
{
parent
::
__construct
(
$config_factory
);
$this
->
languageManager
=
$language_manager
;
$this
->
fileSystem
=
$fileSystem
;
}
/**
...
...
@@ -43,7 +54,8 @@ class ImageCaptchaSettingsForm extends ConfigFormBase {
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'config.factory'
),
$container
->
get
(
'language_manager'
)
$container
->
get
(
'language_manager'
),
$container
->
get
(
'file_system'
)
);
}
...
...
@@ -440,7 +452,7 @@ class ImageCaptchaSettingsForm extends ConfigFormBase {
// Collect the font information.
$fonts
=
[];
foreach
(
$directories
as
$directory
)
{
foreach
(
file_
scan
_d
irectory
(
$directory
,
'/\.[tT][tT][fF]$/'
)
as
$filename
=>
$font
)
{
foreach
(
$this
->
fileSystem
->
scan
D
irectory
(
$directory
,
'/\.[tT][tT][fF]$/'
)
as
$filename
=>
$font
)
{
$fonts
[
hash
(
'sha256'
,
$filename
)]
=
$font
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment