In Depth Guide : Acquia Certified Developer Drupal
  • IN DEPTH GUIDE: ACQUIA CERTIFIED DEVELOPER - DRUPAL 8 EXAM
  • Test Format
  • Domain 1.0: Fundamental Web Development Concepts
    • 1.1 Demonstrate knowledge of HTML and CSS
    • 1.2 Identify Javascript and jQuery programming concepts
    • 1.3 Demonstrate the use of Git for version control
  • Domain 2.0: Site Building
    • 2.1 Demonstrate ability to create and configure Content Types with appropriate fields and field sett
    • 2.2 Demonstrate ability to configure Display Modes for building custom form and view modes for core
    • 2.3 Demonstrate ability to create and use Taxonomy vocabularies and terms for classification and org
    • 2.4 Demonstrate ability to configure Block types, manage Blocks library and configure Block layouts
    • 2.5 Demonstrate ability to build main and alternative navigation systems by using Menus
    • 2.6 Demonstrate ability to create and configure Views for building content list pages, blocks and fe
    • 2.7 Demonstrate ability to use Configuration Management capabilities for exporting site configuratio
    • 2.8 Demonstrate ability to build multilingual websites using core multilingual capabilities
    • 2.9 Demonstrate ability to build RESTful web application using core Web Services capabilities
  • Domain 3.0: Front end development (theming)
    • 3.1 Given a scenario, demonstrate ability to create a custom theme or sub theme.
    • 3.2 Demonstrate knowledge of theming concepts
    • 3.3 Demonstrate ability to use Twig syntax
    • 3.4 Demonstrate ability to build or override Twig templates for defining layout content
    • 3.5 Demonstrate ability to write template pre-process functions for overriding custom output
  • Domain 4.0: Back end development (coding)
    • 4.1 Demonstrate ability to write code using core and Object Oriented PHP
    • 4.2 Demonstrate ability to develop Custom Modules using Drupal API for extending Drupal functionalit
    • 4.3 Demonstrate ability to store and retrieve data using code
    • 4.4 Demonstrate ability to work with other essential APIs
    • 4.5 Demonstrate ability to write code using Drupal Coding Standards
    • 4.6 Demonstrate ability to analyze and resolve site performance issues arising from site configurati
    • 4.7 Demonstrate ability to analyze and resolve security issues arising from site configuration or cu
  • Other Resources
Powered by GitBook
On this page
  • Storing and retrieving data
  • Other Resources
  1. Domain 4.0: Back end development (coding)

4.3 Demonstrate ability to store and retrieve data using code

Previous4.2 Demonstrate ability to develop Custom Modules using Drupal API for extending Drupal functionalitNext4.4 Demonstrate ability to work with other essential APIs

Last updated 7 years ago

Review the difference between how Drupal 8 forms retrieve data as opposed to Drupal 7.

Retrieving settings using the .

Storing and retrieving data

Entities, in Drupal, are objects that are used for persistent storage of content and configuration information. See the Information types topic for an overview of the different types of information, and the Configuration API topic for more about the configuration API.

The Field API allows custom data fields to be attached to Drupal entities and takes care of storing, loading, editing, and rendering field data. Any entity type (node, user, etc.) can use the Field API to make itself "fieldable" and thus allow fields to be attached to it. Other modules can provide a user interface for managing custom fields via a web browser as well as a wide and flexible variety of data type, form element, and display format capabilities.

The Configuration API is one of several methods in Drupal for storing information. See the Information types topic for an overview of the different types of information. The sections below have more information about the configuration API; see for more details.

For example

$config = \Drupal::config('example.settings');
// Will print 'Hello'.
print $config->get('message');
// Will print 'en'.
print $config->get('langcode');
Method: \Drupal::service('config.factory')->getEditable()

The basic entry point into the State API is \Drupal::state(), which returns an object of class \Drupal\Core\State\StateInterface. This class has methods for storing and retrieving state information; each piece of state information is associated with a string-valued key.

For example

// Get the state class.
$state = \Drupal::state();
// Find out when cron was last run; the key is 'system.cron_last'.
$time = $state->get('system.cron_last');
// Set the cron run time to the current request time.
$state->set('system.cron_last', REQUEST_TIME);
For more on the State API, see https://www.drupal.org/developing/api/8/state

The Views module is a generalized query and display engine, which can be used to make views (formatted lists, grids, feeds, and other output) of items (often entities, but can be other types of data).

Drupal's database abstraction layer provides a unified database query API that can query different underlying databases. It is built upon PHP's PDO (PHP Data Objects) database API, and inherits much of its syntax and semantics. Besides providing a unified API for database queries, the database abstraction layer also provides a structured way to construct complex queries, and it protects the database by using good security practices.

Other Resources

configuration API
Entities
Fields
Configuration API
https://www.drupal.org/developing/api/8/configuration
State API
Views
Database abstraction layer
Simple Configuration API