Intro Flashcards

1
Q

Twig Syntax: Say, Do & Comment

A

{{ say something }}
{% do something %}
{# comment on something#}
Say-do-comment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How would you print the value of a variable named title?

A

{{ title }}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How would you print the spotlight region of a page in Drupal 8.x?

A

{{ page.spotlight }}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Twig do something?

A

{% do something %}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Output “footer first” region with HTML

A
{% if page.footer_first %}
  <div class="site-footer\_\_bottom">
    {{ page.footer_first }}
  </div>
{% endif %}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Inheritance in Twig: define extends and block

A

“extends” keyword allow you to dress a template with another template’s markup
“block” defines an area that may be customized; another template’s code may be inserted in this block area

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Inheritance in Twig: define extends

A

extend - dress - other template’s markup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Inheritance in Twig: define block

A

block - another templates code inserted here

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

When template uses extends, what happens?

A

When a template uses extends, all markup is surrounded by block tags to define the custom markup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

To override 3 things:

A

Locate template you want to override
Make a copy
Place in your custom theme/templates folder

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Overrides can be what 2 things?

A

General - override page.html.twig everywhere

Specific - override page.html.twig on node 22

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Some security enhancements in Twig?

A
  1. Twig introduces autoescaping and sanitizes all HTML to prevent XSRF attacks
  2. PHP WILL NOT be executed in a Twig file and will display as plain text
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

XSRF stands for?

A

Cross Site Request Forgeries - big problem in D7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

With Twig, what no longer goes in templates?

A

PHP. No PHP in templates

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

True/False? The render keyword is not used in Twig

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

True/False? Twig is used to output markup in a theme or module

A

True

17
Q

Do theme functions exist in Drupal 8?

A

No

18
Q

ALL markup content is determined by…

A

A Twig template

19
Q

What must you do to upgrade a D7 theme to D8?

A

Convert all tpl.php into html.twig

20
Q

Twig is a templating language for ?

A

PHP

21
Q

Twig outputs variables inside HTML

A

Yes it does