Drupal CMS Flashcards

1
Q

All that is require for Drupal to see your theme is a…

A

.info file

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

What are template files used for?

.tpl.php

A

These templates are used for the (x)HTML markup and PHP variables. In some situations they may output other types of data –xml rss for example. Each .tpl.php file handles the output of a specific themable chunk of data, and in some situations it can handle multiple .tpl.php files through suggestions.

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

What is drush?

A

Drush is a drupal shell

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

What does vagrant halt command do?

A

stops vagrant

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

Drupal has tons of what kind of array?

A

Associative arrays

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

What is a Drupal theme?

A

Themes make Drupal websites beautiful.

Themers are the bridge between the science of code and the art of design.

Drupal markup isn’t the prettiest out of the box, but it’s very flexible in how you alter it.

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

What are the 6 steps for installing a theme?

A
  • Download the theme
  • Extract the files
  • Upload the folder
  • Read the directions
  • Enable the theme
  • Click the ‘save configuration button at the bottom
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the 6 steps for installing a theme?

A
  • Download the theme
  • Extract the files
  • Upload the folder
  • Read the directions
  • Enable the theme
  • Click the ‘save configuration button at the bottom
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A colletion of files that define the presentation layer is called the :

A

theme

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

Which files are typically found in a theme?

A

style.css

page.tpl.php
block.tpl.php
node.tpl.php
template.php
logo.png
screenshot.png
images

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

What is a sub-theme?

A

builds off files of a parent theme, but has it’s own style or differences defined within it’s sub folder.

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

Why do you think Drupal is a powerful and popular CMS compared to others?

A

Drupal allows you to create multiple content types using content construction kits, without any programming skills. It also allows customized theme templates for each content type.

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

What is a module in drupal?

A

A module is a software that extends drupal features and/or functionality.

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

What are hooks in drupal?

A

Hooks are drupal api code which allows modules to interact with the drupal core.

Drupal’s module system is based on the concept of hooks.

A hook is a php function that is named foo_bar(), where “foo” is the name of the module and bar is the name of the hook.

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

When you are creating a drupal module, what 3 files do you need to get started?

A

.info
.module
.install

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

What information needs to go in a .info file?

A
  • name
  • description
  • core
  • dependencies
17
Q

what is hook_schema()? What does it do and what file should it be included in?

A

hook_schema() is a definition structure array. For each element of the array, the key is a table name and the value is a table structure definition, so you create your database tables for your module by using hook_schema().

hook_schema() must be used in the .install file

18
Q

what is hook_schema()? What does it do and what file should it be included in?

A

hook_schema() is a definition structure array. For each element of the array, the key is a table name and the value is a table structure definition, so you create your database tables for your module by using hook_schema().

hook_schema() must be used in the .install file

19
Q

what are some of the main hooks we use to create a module (in the .module file)

A

hook_menu: define menu items and page callbacks
hook_permission: defines user permissions
hook_form: creates a form
hook_validate: validates input
hook_submit: processes input

20
Q

How do we create a form using the Form API and hook_form function?

A

-create a variable called $form which is an associative array where each item in the associative array is a form field which is also an associative array

21
Q

How do we create a form using the Form API and hook_form function?

A
  • create a variable called $form which is an associative array where each item in the associative array is a form field which is also an associative array
  • Drupal form api provides us with field types and valid attributes of those types for us to use
22
Q

how can we create a database table using the hook_schema function and Database API?

A

-create a variable called $schema which is an associative array where each item in the array is a new database table (also represented by an associative array), and each item in that associative array is a column in the table with appropriate attributes (type, length, etc)
-Drupal Database API provides us with:
—to support multiple database servers easily;
to allow developers to leverage more complex functionality, such as transactions;
—to provide a structured interface for the dynamic construction of queries;
—to enforce security checks and other good practices;
—to provide modules with a clean interface for intercepting and modifying a site’s queries.

23
Q

how can we create a database table using the hook_schema function and Database API?

A

-create a variable called $schema which is an associative array where each item in the array is a new database table (also represented by an associative array), and each item in that associative array is a column in the table with appropriate attributes (type, length, etc)
-Drupal Database API provides us with:
—to support multiple database servers easily;
to allow developers to leverage more complex functionality, such as transactions;
—to provide a structured interface for the dynamic construction of queries;
—to enforce security checks and other good practices;
—to provide modules with a clean interface for intercepting and modifying a site’s queries.

24
Q

What is the t() function?

A

the t() function makes strings translatable with Drupals UI so that people using it in different places can read it in their own language.

25
Q

How do we validate input in drupal using hook_validate?

A

We use the variable $form_state that has been passed through the hook_form function. $form_state is an associative array with a value for each form field that has been set. We can use the validate function as a place to check the content of each of our fields and use form_set_error(error name, notification string)

26
Q

How do we process validated input?

A

using the hook_submit function we can process input that has been validated.
We can use the database_insert function to create a new tuple in our database table. we create an associative array called fields, that contains each of the table headings we created in our schema, and is filled with $form_state[value] and then use the execute() function.

27
Q

How do we process validated input?

A

using the hook_submit function we can process input that has been validated.
We can use the database_insert function to create a new tuple in our database table. we create an associative array called fields, that contains each of the table headings we created in our schema, and is filled with $form_state[value] and then use the execute() function.

28
Q

WHy does Drupal use a Database abstraction layer?

A

Drupal provides a database abstraction layer to provide developers with the ability to support multiple database servers easily. The intent of this layer is to preserve the syntax and power of SQL as much as possible, but also allow developers a way to leverage more complex functionality in a unified way. It also provides a structured interface for dynamically constructing queries when appropriate, and enforcing security checks and similar good practices.

The system is built atop PHP’s PDO (PHP Data Objects) database API and inherits much of its syntax and semantics.

Most Drupal database SELECT queries are performed by a call to db_query() or db_query_range(). Module authors should also consider using the PagerDefault Extender for queries that return results that need to be presented on multiple pages

29
Q

WHy does Drupal use a Database abstraction layer?

A

Drupal provides a database abstraction layer to provide developers with the ability to support multiple database servers easily. The intent of this layer is to preserve the syntax and power of SQL as much as possible, but also allow developers a way to leverage more complex functionality in a unified way. It also provides a structured interface for dynamically constructing queries when appropriate, and enforcing security checks and similar good practices.

The system is built atop PHP’s PDO (PHP Data Objects) database API and inherits much of its syntax and semantics.

Most Drupal database SELECT queries are performed by a call to db_query() or db_query_range(). Module authors should also consider using the PagerDefault Extender for queries that return results that need to be presented on multiple pages

30
Q

What is Presentation-Abstraction-Control (PAC)?

A

Presentation–abstraction–control (PAC) is a software architectural pattern. It is an interaction-oriented software architecture, a it separates an interactive system into three types of components responsible for specific aspects of the application’s functionality.

The abstraction component retrieves and processes the data, the presentation component formats the visual and audio presentation of data, and the control component handles things such as the flow of control and communication between the other two components.

PAC is used as a hierarchical structure of agents, each consisting of a triad of presentation, abstraction and control parts. The agents (or triads) communicate with each other only through the control part of each triad. Within each triad, it completely insulates the presentation and the abstraction. This provides the option to separately multithread the model and view which can give the user experience of very short program start times, as the user interface (presentation) can be shown before the abstraction has fully initialized.

31
Q

What is Presentation-Abstraction-Control (PAC)?

A

Presentation–abstraction–control (PAC) is a software architectural pattern. It is an interaction-oriented software architecture, a it separates an interactive system into three types of components responsible for specific aspects of the application’s functionality.

The abstraction component retrieves and processes the data, the presentation component formats the visual and audio presentation of data, and the control component handles things such as the flow of control and communication between the other two components.

PAC is used as a hierarchical structure of agents, each consisting of a triad of presentation, abstraction and control parts. The agents (or triads) communicate with each other only through the control part of each triad. Within each triad, it completely insulates the presentation and the abstraction. This provides the option to separately multithread the model and view which can give the user experience of very short program start times, as the user interface (presentation) can be shown before the abstraction has fully initialized.

32
Q

what is the function variable_get?

A

Returns a persistent variable.

Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.

Parameters:

$name: The name of the variable to return.

$default: The default value to use if this variable has never been set.

Return value:

The value of the variable. Unserialization is taken care of as necessary.

33
Q

what is the function variable_del?

A

Unsets a persistent variable.

Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.

Parameters:

$name: The name of the variable to undefine.

34
Q

what is the function variable_set?

A

Sets a persistent variable.

Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.

Parameters:

$name: The name of the variable to set.

$value: The value to set. This can be any PHP data type; these functions take care of serialization as necessary.

35
Q

when do we use the get/set/del functions?

A

When retrieving, updating or removing data from our database