Loading modules/o365_onedrive/o365_onedrive.module 100644 → 100755 +0 −0 File mode changed from 100644 to 100755. View file modules/o365_onedrive/src/Plugin/Block/RecentFilesBlock.php +55 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\o365\Block\O365UncachedBlockBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\o365_onedrive\GetFilesAndFoldersServiceInterface; use Drupal\Core\Form\FormStateInterface; /** * Provides a 'Recent Files' block. Loading Loading @@ -57,7 +58,60 @@ class RecentFilesBlock extends O365UncachedBlockBase implements ContainerFactory * @throws \Microsoft\Graph\Exception\GraphException */ public function build() { return $this->getFilesAndFoldersService->listSpecialFilesAndFolders('recent'); $blockData = $this->getFilesAndFoldersService->listSpecialFilesAndFolders('recent'); if (!empty($blockData)) { return $blockData; } $config = $this->getConfiguration(); if ($config['show_recent_files_block']) { return [ '#theme' => 'o365_onedrive_results', '#results' => $config['recent_files_block_text'], ]; } return []; } /** * {@inheritdoc} */ public function blockForm($form, FormStateInterface $form_state) { $form = parent::blockForm($form, $form_state); $form['show_recent_files_block'] = [ '#type' => 'checkbox', '#title' => $this->t('Show recent files when there is no data'), ]; $form['recent_files_block_text'] = [ '#type' => 'textarea', '#title' => t('Recent files block text'), '#description' => t('Enter the text you would like to show'), '#default_value' => t('Enter the text you would like to show'), '#states' => [ 'visible' => [ 'input[name="show_recent_files_block"]' => [ 'checked' => TRUE, ], ], ], ]; return $form; } /** * {@inheritdoc} */ public function blockSubmit($form, FormStateInterface $form_state) { $values = $form_state->getValues(); $this->configuration['show_recent_files_block'] = $values['show_recent_files_block']; $this->configuration['recent_files_block_text'] = $values['recent_files_block_text']; } } modules/o365_onedrive/src/Plugin/Block/SharedFilesBlock.php +53 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\o365_onedrive\Plugin\Block; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\o365\Block\O365UncachedBlockBase; use Symfony\Component\DependencyInjection\ContainerInterface; Loading Loading @@ -57,7 +58,58 @@ class SharedFilesBlock extends O365UncachedBlockBase implements ContainerFactory * @throws \Microsoft\Graph\Exception\GraphException */ public function build() { return $this->getFilesAndFoldersService->listSharedFilesAndFolders(); $blockData = $this->getFilesAndFoldersService->listSharedFilesAndFolders(); if (!empty($blockData)) { return $blockData; } $config = $this->getConfiguration(); if ($config['show_shared_files_block']) { return [ '#theme' => 'o365_onedrive_results', '#results' => $config['show_shared_files_block'], ]; } return []; } /** * {@inheritdoc} */ public function blockForm($form, FormStateInterface $form_state) { $form = parent::blockForm($form, $form_state); $form['show_shared_files_block'] = [ '#type' => 'checkbox', '#title' => $this->t('Show shared files when there is no data'), ]; $form['shared_files_block_text'] = [ '#type' => 'textarea', '#title' => t('Shared files block text'), '#description' => t('Enter the text you would like to show'), '#default_value' => t('Enter the text you would like to show'), '#states' => [ 'visible' => [ 'input[name="show_shared_files_block"]' => [ 'checked' => TRUE, ], ], ], ]; return $form; } /** * {@inheritdoc} */ public function blockSubmit($form, FormStateInterface $form_state) { $values = $form_state->getValues(); $this->configuration['show_shared_files_block'] = $values['show_shared_files_block']; $this->configuration['shared_files_block_text'] = $values['shared_files_block_text']; } } modules/o365_outlook_calendar/src/Plugin/Block/CalendarBlock.php +26 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,26 @@ class CalendarBlock extends O365UncachedBlockBase implements ContainerFactoryPlu '#max' => 999, ]; $form['show_calendar_block'] = [ '#type' => 'checkbox', '#title' => $this->t('Show the calendar block when there is no data'), ]; $form['calendar_block_text'] = [ '#type' => 'textarea', '#title' => t('Mail block text'), '#description' => t('Enter the text you would like to show'), '#default_value' => t('Enter the text you would like to show'), '#states' => [ 'visible' => [ 'input[name="show_calendar_block"]' => [ 'checked' => TRUE, ], ], ], ]; return $form; } Loading @@ -110,6 +130,8 @@ class CalendarBlock extends O365UncachedBlockBase implements ContainerFactoryPlu public function blockSubmit($form, FormStateInterface $form_state) { $values = $form_state->getValues(); $this->configuration['amount'] = $values['amount']; $this->configuration['show_calendar_block'] = $values['show_calendar_block']; $this->configuration['calendar_block_text'] = $values['calendar_block_text']; } /** Loading Loading @@ -172,6 +194,10 @@ class CalendarBlock extends O365UncachedBlockBase implements ContainerFactoryPlu } } if ($config['show_calendar_block']) { return $items == $config['calendar_block_text']; } if (!empty($items)) { $build['content'] = [ '#theme' => 'o365_calendar_list', Loading modules/o365_outlook_mail/src/Plugin/Block/LatestMailBlock.php +54 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\o365\Block\O365UncachedBlockBase; use Drupal\o365_outlook_mail\GetMailServiceInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Form\FormStateInterface; /** * Provides a 'Latest Mail' block. Loading Loading @@ -57,7 +58,22 @@ class LatestMailBlock extends O365UncachedBlockBase implements ContainerFactoryP * @throws \Microsoft\Graph\Exception\GraphException */ public function build() { return $this->getMails(); $mails = $this->getMails(); if (!empty($mails)) { return $mails; } $config = $this->getConfiguration(); if ($config['show_latest_mail_block']) { return [ '#theme' => 'o365_outlook_mail_list_block', '#readmore_class' => 'button--primary button', '#list' => $config['latest_mail_block_text'], ]; } return []; } /** Loading Loading @@ -90,4 +106,41 @@ class LatestMailBlock extends O365UncachedBlockBase implements ContainerFactoryP return []; } /** * {@inheritdoc} */ public function blockForm($form, FormStateInterface $form_state) { $form = parent::blockForm($form, $form_state); $form['show_latest_mail_block'] = [ '#type' => 'checkbox', '#title' => $this->t('Show latest mail\'s when there is no data'), ]; $form['latest_mail_block_text'] = [ '#type' => 'textarea', '#title' => t('Mail block text'), '#description' => t('Enter the text you would like to show'), '#default_value' => t('Enter the text you would like to show'), '#states' => [ 'visible' => [ 'input[name="show_latest_mail_block"]' => [ 'checked' => TRUE, ], ], ], ]; return $form; } /** * {@inheritdoc} */ public function blockSubmit($form, FormStateInterface $form_state) { $values = $form_state->getValues(); $this->configuration['show_latest_mail_block'] = $values['show_latest_mail_block']; $this->configuration['latest_mail_block_text'] = $values['latest_mail_block_text']; } } Loading
modules/o365_onedrive/o365_onedrive.module 100644 → 100755 +0 −0 File mode changed from 100644 to 100755. View file
modules/o365_onedrive/src/Plugin/Block/RecentFilesBlock.php +55 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\o365\Block\O365UncachedBlockBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\o365_onedrive\GetFilesAndFoldersServiceInterface; use Drupal\Core\Form\FormStateInterface; /** * Provides a 'Recent Files' block. Loading Loading @@ -57,7 +58,60 @@ class RecentFilesBlock extends O365UncachedBlockBase implements ContainerFactory * @throws \Microsoft\Graph\Exception\GraphException */ public function build() { return $this->getFilesAndFoldersService->listSpecialFilesAndFolders('recent'); $blockData = $this->getFilesAndFoldersService->listSpecialFilesAndFolders('recent'); if (!empty($blockData)) { return $blockData; } $config = $this->getConfiguration(); if ($config['show_recent_files_block']) { return [ '#theme' => 'o365_onedrive_results', '#results' => $config['recent_files_block_text'], ]; } return []; } /** * {@inheritdoc} */ public function blockForm($form, FormStateInterface $form_state) { $form = parent::blockForm($form, $form_state); $form['show_recent_files_block'] = [ '#type' => 'checkbox', '#title' => $this->t('Show recent files when there is no data'), ]; $form['recent_files_block_text'] = [ '#type' => 'textarea', '#title' => t('Recent files block text'), '#description' => t('Enter the text you would like to show'), '#default_value' => t('Enter the text you would like to show'), '#states' => [ 'visible' => [ 'input[name="show_recent_files_block"]' => [ 'checked' => TRUE, ], ], ], ]; return $form; } /** * {@inheritdoc} */ public function blockSubmit($form, FormStateInterface $form_state) { $values = $form_state->getValues(); $this->configuration['show_recent_files_block'] = $values['show_recent_files_block']; $this->configuration['recent_files_block_text'] = $values['recent_files_block_text']; } }
modules/o365_onedrive/src/Plugin/Block/SharedFilesBlock.php +53 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\o365_onedrive\Plugin\Block; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\o365\Block\O365UncachedBlockBase; use Symfony\Component\DependencyInjection\ContainerInterface; Loading Loading @@ -57,7 +58,58 @@ class SharedFilesBlock extends O365UncachedBlockBase implements ContainerFactory * @throws \Microsoft\Graph\Exception\GraphException */ public function build() { return $this->getFilesAndFoldersService->listSharedFilesAndFolders(); $blockData = $this->getFilesAndFoldersService->listSharedFilesAndFolders(); if (!empty($blockData)) { return $blockData; } $config = $this->getConfiguration(); if ($config['show_shared_files_block']) { return [ '#theme' => 'o365_onedrive_results', '#results' => $config['show_shared_files_block'], ]; } return []; } /** * {@inheritdoc} */ public function blockForm($form, FormStateInterface $form_state) { $form = parent::blockForm($form, $form_state); $form['show_shared_files_block'] = [ '#type' => 'checkbox', '#title' => $this->t('Show shared files when there is no data'), ]; $form['shared_files_block_text'] = [ '#type' => 'textarea', '#title' => t('Shared files block text'), '#description' => t('Enter the text you would like to show'), '#default_value' => t('Enter the text you would like to show'), '#states' => [ 'visible' => [ 'input[name="show_shared_files_block"]' => [ 'checked' => TRUE, ], ], ], ]; return $form; } /** * {@inheritdoc} */ public function blockSubmit($form, FormStateInterface $form_state) { $values = $form_state->getValues(); $this->configuration['show_shared_files_block'] = $values['show_shared_files_block']; $this->configuration['shared_files_block_text'] = $values['shared_files_block_text']; } }
modules/o365_outlook_calendar/src/Plugin/Block/CalendarBlock.php +26 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,26 @@ class CalendarBlock extends O365UncachedBlockBase implements ContainerFactoryPlu '#max' => 999, ]; $form['show_calendar_block'] = [ '#type' => 'checkbox', '#title' => $this->t('Show the calendar block when there is no data'), ]; $form['calendar_block_text'] = [ '#type' => 'textarea', '#title' => t('Mail block text'), '#description' => t('Enter the text you would like to show'), '#default_value' => t('Enter the text you would like to show'), '#states' => [ 'visible' => [ 'input[name="show_calendar_block"]' => [ 'checked' => TRUE, ], ], ], ]; return $form; } Loading @@ -110,6 +130,8 @@ class CalendarBlock extends O365UncachedBlockBase implements ContainerFactoryPlu public function blockSubmit($form, FormStateInterface $form_state) { $values = $form_state->getValues(); $this->configuration['amount'] = $values['amount']; $this->configuration['show_calendar_block'] = $values['show_calendar_block']; $this->configuration['calendar_block_text'] = $values['calendar_block_text']; } /** Loading Loading @@ -172,6 +194,10 @@ class CalendarBlock extends O365UncachedBlockBase implements ContainerFactoryPlu } } if ($config['show_calendar_block']) { return $items == $config['calendar_block_text']; } if (!empty($items)) { $build['content'] = [ '#theme' => 'o365_calendar_list', Loading
modules/o365_outlook_mail/src/Plugin/Block/LatestMailBlock.php +54 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\o365\Block\O365UncachedBlockBase; use Drupal\o365_outlook_mail\GetMailServiceInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Form\FormStateInterface; /** * Provides a 'Latest Mail' block. Loading Loading @@ -57,7 +58,22 @@ class LatestMailBlock extends O365UncachedBlockBase implements ContainerFactoryP * @throws \Microsoft\Graph\Exception\GraphException */ public function build() { return $this->getMails(); $mails = $this->getMails(); if (!empty($mails)) { return $mails; } $config = $this->getConfiguration(); if ($config['show_latest_mail_block']) { return [ '#theme' => 'o365_outlook_mail_list_block', '#readmore_class' => 'button--primary button', '#list' => $config['latest_mail_block_text'], ]; } return []; } /** Loading Loading @@ -90,4 +106,41 @@ class LatestMailBlock extends O365UncachedBlockBase implements ContainerFactoryP return []; } /** * {@inheritdoc} */ public function blockForm($form, FormStateInterface $form_state) { $form = parent::blockForm($form, $form_state); $form['show_latest_mail_block'] = [ '#type' => 'checkbox', '#title' => $this->t('Show latest mail\'s when there is no data'), ]; $form['latest_mail_block_text'] = [ '#type' => 'textarea', '#title' => t('Mail block text'), '#description' => t('Enter the text you would like to show'), '#default_value' => t('Enter the text you would like to show'), '#states' => [ 'visible' => [ 'input[name="show_latest_mail_block"]' => [ 'checked' => TRUE, ], ], ], ]; return $form; } /** * {@inheritdoc} */ public function blockSubmit($form, FormStateInterface $form_state) { $values = $form_state->getValues(); $this->configuration['show_latest_mail_block'] = $values['show_latest_mail_block']; $this->configuration['latest_mail_block_text'] = $values['latest_mail_block_text']; } }