nys_ds
Overview
This module's purpose is to provide an easy way to incorporate components from the NYS Design System into existing Drupal websites or new Drupal websites which feature a traditional frontend using a traditional theme. This module isn't intended for use with detached frontends/SPAs; for that you should simply include the entire design system as a part of your project.
Methodology
The NYSDS Libraries module uses Drupal's built-in component registration system to create template references developers can use to incorporate NYSDS components into their Drupal website. We have extensive documentation on our reasoning behind this methodology.
Using the component templates
Here's an example of incorporating the alert component on a block template:
{% set alertTypeLabel = fields.field_alert_type.content %}
{% if alertTypeLabel == 'Warning' %}
{% set alertType = "danger" %}
{% set alertIcon = "warning" %}
{% elseif alertTypeLabel == 'Information' %}
{% set alertType = "warning" %}
{% set alertIcon = "info" %}
{% endif %}
{% set alertLabel = fields.field_alert_label.content %}
{% include 'nys_ds:alert' with {
type: alertType,
icon: alertIcon,
heading: alertLabel,
text: fields.field_alert_message.content,
primaryLabel: alertTypeLabel
}
%}
Please review our documentation for more detailed information on how to incorporate the components into your website, particularly in regards to webform components.
Installing the Module
We recommend installing the version of this module that corresponds to the version of the NYSDS you want to install. Please see our documentation on this topic.