/** * {@inheritdoc} */ public function blockSubmit($form, FormStateInterface $form_state) { $config = \Drupal::service('config.factory')->getEditable('follow.settings'); $values = $form_state->getValues(); $config->set('follow_user_block_title', $values['follow_title'])->save(); $config->set('follow_user_alignment', $values['follow_alignment'])->save(); $config->set('follow_user_icon_style', $values['follow_icon_style'])->save(); // Reset the CSS in case the styles changed. follow_save_css(TRUE); }
public function follow_css() { $directory_path = \Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath(); $destination = $directory_path . '/css/follow.css'; if ($destination == follow_save_css()) { new BinaryFileResponse($destination, 200, array('Content-Type' => 'text/css', 'Content-Length' => filesize($destination))); } else { \Drupal::logger('follow')->notice('Unable to generate the Follow CSS located at %path.', array('%path' => $destination)); throw new ServiceUnavailableHttpException(0, t('Error generating CSS.'), 'Status', '500 Internal Server Error'); } }