Loading 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 @@ -170,6 +192,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 Loading
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 @@ -170,6 +192,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