Commit 25150c0c authored by Jesse van de Water's avatar Jesse van de Water Committed by Fabian de Rijk
Browse files

#3272948: improved commit

parent cee937c3
Loading
Loading
Loading
Loading
+0 −36
Original line number Diff line number Diff line
@@ -5,8 +5,6 @@
 * Onedrive module.
 */

use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_theme().
 */
@@ -36,37 +34,3 @@ function o365_onedrive_o365_auth_scopes(array &$scopes) {
  $scopes[] = 'Files.Read.All';
  $scopes[] = 'Files.Read.Selected';
}

function o365_onedrive_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $config = \Drupal::config('o365.block_settings');

  if ($form_id == 'block_settings_form') {

    //    $form['value']['onedrive_block'] = [
    $form['block_onedrive'] = [
      '#type' => 'textarea',
      '#title' => t('OneDrive block text'),
      '#description' => t('Enter the text you would like to show'),
      '#default_value' => $config->get('block_onedrive'),
      '#states' => [
        'visible' => [
          ':input[name="show_block"]' => ['checked' => TRUE],
        ],
      ],
    ];
  }

}

/**
 * Implements hook_preprocess().
 */
function o365_onedrive_preprocess_page(&$variables) {

  if (\Drupal::config('o365.block_settings')->get('show_block') == TRUE) {
    $variables['block_onedrive'] = \Drupal::config('o365.block_settings')
      ->get('block_onedrive');
  }

}
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ class RecentFilesBlock extends O365UncachedBlockBase implements ContainerFactory

    $form['show_recent_files_block'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Show latest unread mail\'s when there is no data'),
      '#title' => $this->t('Show recent file\'s when there is no data'),
    ];

    $form['recent_files_block_text'] = [
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ class SharedFilesBlock extends O365UncachedBlockBase implements ContainerFactory

    $form['show_shared_files_block'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Show latest unread mail\'s when there is no data'),
      '#title' => $this->t('Show shared file\'s when there is no data'),
    ];

    $form['shared_files_block_text'] = [
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ class LatestMailBlock extends O365UncachedBlockBase implements ContainerFactoryP

    $form['show_latest_mail_block'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Show latest unread mail\'s when there is no data'),
      '#title' => $this->t('Show latest mail\'s when there is no data'),
    ];

    $form['latest_mail_block_text'] = [
+0 −5
Original line number Diff line number Diff line
@@ -8,11 +8,6 @@ o365.api_settings_form:
  route_name: o365.api_settings_form
  description: 'API settings for the Office 365 Connector module'
  parent: o365.settings_form
o365.block_settings_form:
  title: 'Block Settings'
  route_name: o365.block_settings_form
  description: 'General block settings for the Office 365 Connector module'
  parent: o365.block_settings_form
o365.auth_scopes:
  title: 'Office 365 scopes'
  description: 'The needed authorization scopes for correct Office 365 integration'
Loading