From b53269374752e5ebafc090075e95a926dea73dce Mon Sep 17 00:00:00 2001 From: "Eirik S. Morland" Date: Sun, 10 May 2015 12:02:52 +0200 Subject: [PATCH] Move one more block to template (relates to #11) and add price info in signup block. --- .../modules/custom/camposlo/camposlo.module | 3 +++ .../camposlo/src/Plugin/Block/SignupBlock.php | 23 +++++++++---------- .../camposlo-register-block.html.twig | 15 ++++++++++++ 3 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 drupal/modules/custom/camposlo/templates/camposlo-register-block.html.twig diff --git a/drupal/modules/custom/camposlo/camposlo.module b/drupal/modules/custom/camposlo/camposlo.module index 8fffb7ed..185b9be8 100644 --- a/drupal/modules/custom/camposlo/camposlo.module +++ b/drupal/modules/custom/camposlo/camposlo.module @@ -34,6 +34,9 @@ function camposlo_theme() { 'camposlo-contact-block' => [ 'variables' => [], ], + 'camposlo-register-block' => [ + 'variables' => ['register_link' => []], + ], ]; return $theme; diff --git a/drupal/modules/custom/camposlo/src/Plugin/Block/SignupBlock.php b/drupal/modules/custom/camposlo/src/Plugin/Block/SignupBlock.php index 4538931c..7e219681 100644 --- a/drupal/modules/custom/camposlo/src/Plugin/Block/SignupBlock.php +++ b/drupal/modules/custom/camposlo/src/Plugin/Block/SignupBlock.php @@ -83,18 +83,17 @@ protected function blockAccess(AccountInterface $account) { */ public function build() { return array( - '#markup' => '
-
-
-
-

' . $this->t('Sign up!') . '

- -

' . $this->t('Register') . '

-
-
-
- -
', + '#theme' => 'camposlo-register-block', + '#register_link' => array( + '#type' => 'link', + '#url' => Url::fromRoute('user.register'), + '#title' => $this->t('Register'), + '#attributes' => [ + 'class' => [ + 'btn btn-primary btn-lg', + ], + ], + ), ); } diff --git a/drupal/modules/custom/camposlo/templates/camposlo-register-block.html.twig b/drupal/modules/custom/camposlo/templates/camposlo-register-block.html.twig new file mode 100644 index 00000000..39bae889 --- /dev/null +++ b/drupal/modules/custom/camposlo/templates/camposlo-register-block.html.twig @@ -0,0 +1,15 @@ +'
+
+
+
+

{%trans%}Sign up!{%endtrans%}

+

+ {%trans%}Price is either 200,- for members in the Norwegian Drupal Association or 300,- for non-members. Membership costs 200,-. You can register now and pay later.{%endtrans%} +

+

+ {{register_link}} +

+
+
+
+
'