Get Checkbox Value From Another Form How do i get the value of a checkbox from another form/page and how do i make it so if the checkbox is enabled, it'll allow a button to be visible?

checkbox in SettingsForm.php:

$form['#tree'] = TRUE;
    $form['clients_enabled'] = array(
      '#title' =&gt; t('Enable PixelPin OpenID Connect'),
      '#type' =&gt; 'checkboxes',
      '#options' =&gt; array('pixelpin' =&gt; $this-&gt;t('Enable')), 
      '#default_value' =&gt; $clients_enabled,
    );


button ion LoginForm.php:

public function buildForm(array $form, FormStateInterface $form_state) {
    $definitions = $this-&gt;pluginManager-&gt;getDefinitions();
    foreach ($definitions as $client_id =&gt; $client) {
      foreach ($this-&gt;pluginManager-&gt;getDefinitions() as $client_name =&gt; $client_plugin) {
        if (!$this-&gt;config('pixelpin_openid_connect.settings.' . $client_id)
          -&gt;get('enabled')) {             
          $url = \Drupal::service('path.current')-&gt;getPath();

          $find = 'login';

          $pos = strpos($url, $find);

          if ($pos === false){
                $value = 'Register Using @client_title';
            } else {
                $value = 'Log in with @client_title';
            } 

          $element = 'clients_enabled[' . $client_plugin['id'] . ']';
          $form['pixelpin_openid_connect_client_' . $client_id . '_login'] = array(
            '#type' =&gt; 'submit',
            '#value' =&gt; t($value, array(
              '@client_title' =&gt; $client['label'],
            )),
            'visible' =&gt; array(
              ':input[name="' . $element . '"]' =&gt; array('checked' =&gt; TRUE),
            ),
            '#name' =&gt; $client_id,
            '#prefix' =&gt; '&lt;div&gt;',
            '#suffix' =&gt; '&lt;/div&gt;',
          );
        }
      }
    }
    return $form;
Create a config file inside your_module/config/install/. 

Inside SettingsForm.php write,

$form['#tree'] = TRUE;
$form['clients_enabled'] = array(
  '#title' =&gt; t('Enable PixelPin OpenID Connect'),
  '#type' =&gt; 'checkboxes',
  '#options' =&gt; array('pixelpin' =&gt; $this-&gt;t('Enable')), 
  '#default_value' =&gt; $clients_enabled,
);

public function submitForm(array &amp;$form, FormStateInterface $form_state) {
  $config = $this-&gt;config('pixelpin_openid_connect.settings');
  $config-&gt;set('clients_enabled_key', $form_state-&gt;getValue('clients_enabled'))-&gt;save();

}


Inside LoginForm.php, get it :

public function buildForm(array $form, FormStateInterface $form_state) {
$definitions = $this-&gt;pluginManager-&gt;getDefinitions();
foreach ($definitions as $client_id =&gt; $client) {
  foreach ($this-&gt;pluginManager-&gt;getDefinitions() as $client_name =&gt; $client_plugin) {
$is_enabled = isset($this-&gt;config('pixelpin_openid_connect.settings')
      -&gt;get('clients_enabled')) ? $this-&gt;config('pixelpin_openid_connect.settings')
      -&gt;get('clients_enabled') : false;
    if ($is_enabled) {             
      $url = \Drupal::service('path.current')-&gt;getPath();

      $find = 'login';

      $pos = strpos($url, $find);

      if ($pos === false){
            $value = 'Register Using @client_title';
        } else {
            $value = 'Log in with @client_title';
        } 

      $element = 'clients_enabled[' . $client_plugin['id'] . ']';
      $form['pixelpin_openid_connect_client_' . $client_id . '_login'] = array(
        '#type' =&gt; 'submit',
        '#value' =&gt; t($value, array(
          '@client_title' =&gt; $client['label'],
        )),
        'visible' =&gt; array(
          ':input[name="' . $element . '"]' =&gt; array('checked' =&gt; TRUE),
        ),
        '#name' =&gt; $client_id,
        '#prefix' =&gt; '&lt;div&gt;',
        '#suffix' =&gt; '&lt;/div&gt;',
      );
    }
  }
}
return $form;
}