Skip to content
Snippets Groups Projects
Commit ee534fd2 authored by David Galeano's avatar David Galeano
Browse files

Issue #3480854 by gxleano: Add clear cache method in form submit

parent ccc40985
No related branches found
Tags 8.x-1.0
2 merge requests!23Issue #3480854 by gxleano: Add settings form to allow collections and create...,!22Issue #3480854 by gxleano: Add settings form to allow collections and create...
......@@ -117,11 +117,25 @@ class Settings extends ConfigFormBase {
->set('collections', array_combine($collections, $collections))
->save();
// Clear caches after submit the form.
drupal_flush_all_caches();
$this->messenger()->addStatus($this->t('Cache has been cleared.'));
parent::submitForm($form, $form_state);
}
/**
* TBD.
* Gets a formatted collection name for display purposes.
*
* @param array $collection
* An associative array containing information about the icon collection.
* @param string $collection_id
* The unique identifier of the collection, used to create the link.
*
* @return string
* A formatted string with the collection's name, category, total icons,
* and a link to view the collection on the Iconify website.
*/
protected function getCustomCollectionName(array $collection, string $collection_id): string {
return sprintf(
......@@ -134,7 +148,14 @@ class Settings extends ConfigFormBase {
}
/**
* TBD.
* Gets options for a select list of icon collections.
*
* @return array
* An associative array where the keys are collection IDs and the values are
* formatted collection names for display in a form select element.
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \JsonException
*/
protected function getOptions(): array {
// Fetch and sort collections by 'total' in descending order.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment