Created
July 20, 2016 18:31
-
-
Save scottalan/85027831e1a116716be2c7563a052d7c to your computer and use it in GitHub Desktop.
D8:configFactory - Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Get the names of all categories. | |
| * | |
| * @return array | |
| * A list of existing category IDs. | |
| */ | |
| function wysiwyg_template_category_get_names() { | |
| $names = &drupal_static(__FUNCTION__); | |
| if (!isset($names)) { | |
| $names = array(); | |
| $config_names = \Drupal::configFactory() | |
| ->listAll('wysiwyg_template_content.category.'); | |
| foreach ($config_names as $config_name) { | |
| $id = substr($config_name, strlen('wysiwyg_template_content.category.')); | |
| $names[$id] = $id; | |
| } | |
| } | |
| return $names; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment