Get() on array in settings from custom Form controller I'm making a custom module with a form controller, that has a text_format field.
I'm storing the text_format value in my submitForm function like so.

public function submitForm(array&amp;$form, FormStateInterface $form_state) {
    $this-&gt;config('foundation.settings')
         -&gt;set('infoblock_text', $form_state-&gt;getValue('infoblock_text'))
        -&gt;save();
}


I'm attempting to retrieve that for the default value of the field like so

    $form['infoblock_text'] = [
        '#type'          =&gt; 'text_format',
        '#title'         =&gt; t('Infoblock text'),
        '#description'   =&gt; t('The body text for the infoblock on the front page'),
        '#format'        =&gt; 'full_html',
        '#default_value' =&gt; $config-&gt;get('infoblock_text'),
    ];


However it's empty. After performing a die(print_r($config->get('infoblock_text'))) I found that infoblock_text is actually an array and 'value' is the key that contains the text I need. This is what the die() statement returns

Array ( [value] =&gt;
Text of infoblock
[format] =&gt; full_html ) 1


After seeing that I actually needed to retrieve the value element rather the entire array I attempted the following with no luck.

$config-&gt;get('infoblock_text', 'value');
$config-&gt;get(['infoblock_text', 'value']);
$config-&gt;get('infoblock_text')-&gt;value;
$config-&gt;get('infoblock_text')-&gt;value();
$config-&gt;get('infoblock_text')-&gt;getValue();
$config-&gt;getValue('infoblock_text');
$config-&gt;getValue('infoblock_text');
$config-&gt;getValue('infoblock_text');


So how would I actually retrieve the value of 'infoblock_text', when $config->get('infoblock_text') returns the entire array?
You can handle the config like an array:

$form['infoblock_text'] = [
    '#type'          =&gt; 'text_format',
    '#title'         =&gt; t('Infoblock text'),
    '#description'   =&gt; t('The body text for the infoblock on the front page'),
    '#format'        =&gt; isset($config-&gt;get('infoblock_text')['format']) ? $config-&gt;get('infoblock_text')['format'] : 'full_html',
    '#default_value' =&gt; isset($config-&gt;get('infoblock_text')['value']) ? $config-&gt;get('infoblock_text')['value'] : '',
];


When accessing the array like this, it's always a good idea to check if the key is set. This avoids warnings in your log.