Commit bacc4f4e authored by Caleb Crawley's avatar Caleb Crawley Committed by Neil Drumm
Browse files

Issue #3301882 by crawleyhost: Add “Affected versions” field to the security advisory content type

parent bedd316d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -7948,6 +7948,9 @@ function drupalorg_form_sa_node_form_alter(&$form, &$form_state) {
    }
  }

  // Validate Composer verison constraint.
  $form['field_affected_versions'][LANGUAGE_NONE]['#element_validate'][] = '_drupalorg_validate_version_constraint';

  $form['#validate'][] = '_drupalorg_sa_validate';
  $form['#submit'][] = 'drupalorg_sa_save';
}
+22 −0
Original line number Diff line number Diff line
@@ -11,6 +11,28 @@
function drupalorg_security_advisories_field_default_field_bases() {
  $field_bases = array();

  // Exported field_base: 'field_affected_versions'.
  $field_bases['field_affected_versions'] = array(
    'active' => 1,
    'cardinality' => 1,
    'deleted' => 0,
    'entity_id_type' => NULL,
    'entity_types' => array(),
    'field_name' => 'field_affected_versions',
    'indexes' => array(
      'format' => array(
        0 => 'format',
      ),
    ),
    'locked' => 0,
    'module' => 'text',
    'settings' => array(
      'max_length' => 255,
    ),
    'translatable' => 0,
    'type' => 'text',
  );

  // Exported field_base: 'field_is_psa'.
  $field_bases['field_is_psa'] = array(
    'active' => 1,
+72 −6
Original line number Diff line number Diff line
@@ -194,6 +194,70 @@ function drupalorg_security_advisories_field_default_field_instances() {
    ),
  );

  // Exported field_instance: 'node-sa-field_affected_versions'.
  $field_instances['node-sa-field_affected_versions'] = array(
    'bundle' => 'sa',
    'default_value' => NULL,
    'deleted' => 0,
    'description' => '<a href="https://getcomposer.org/doc/articles/versions.md#writing-version-constraints">Writing Composer version constraints</a>.',
    'display' => array(
      'default' => array(
        'label' => 'inline',
        'module' => 'text',
        'settings' => array(),
        'type' => 'text_default',
        'weight' => 5,
      ),
      'issuemetadata' => array(
        'label' => 'above',
        'settings' => array(),
        'type' => 'hidden',
        'weight' => 0,
      ),
      'map_teaser' => array(
        'label' => 'above',
        'settings' => array(),
        'type' => 'hidden',
        'weight' => 0,
      ),
      'nodechanges' => array(
        'label' => 'above',
        'settings' => array(),
        'type' => 'hidden',
        'weight' => 0,
      ),
      'related_content' => array(
        'label' => 'above',
        'settings' => array(),
        'type' => 'hidden',
        'weight' => 0,
      ),
      'teaser' => array(
        'label' => 'above',
        'settings' => array(),
        'type' => 'hidden',
        'weight' => 0,
      ),
    ),
    'entity_type' => 'node',
    'field_name' => 'field_affected_versions',
    'label' => 'Affected versions',
    'required' => 0,
    'settings' => array(
      'text_processing' => 0,
      'user_register_form' => FALSE,
    ),
    'widget' => array(
      'active' => 1,
      'module' => 'text',
      'settings' => array(
        'size' => 60,
      ),
      'type' => 'text_textfield',
      'weight' => 6,
    ),
  );

  // Exported field_instance: 'node-sa-field_is_psa'.
  $field_instances['node-sa-field_is_psa'] = array(
    'bundle' => 'sa',
@@ -610,7 +674,7 @@ function drupalorg_security_advisories_field_default_field_instances() {
        'module' => 'text',
        'settings' => array(),
        'type' => 'text_default',
        'weight' => 10,
        'weight' => 11,
      ),
      'issuemetadata' => array(
        'label' => 'above',
@@ -739,7 +803,7 @@ function drupalorg_security_advisories_field_default_field_instances() {
        'module' => 'text',
        'settings' => array(),
        'type' => 'text_default',
        'weight' => 5,
        'weight' => 6,
      ),
      'issuemetadata' => array(
        'label' => 'above',
@@ -805,7 +869,7 @@ function drupalorg_security_advisories_field_default_field_instances() {
        'module' => 'text',
        'settings' => array(),
        'type' => 'text_default',
        'weight' => 6,
        'weight' => 7,
      ),
      'issuemetadata' => array(
        'label' => 'above',
@@ -873,7 +937,7 @@ function drupalorg_security_advisories_field_default_field_instances() {
        'module' => 'text',
        'settings' => array(),
        'type' => 'text_default',
        'weight' => 9,
        'weight' => 10,
      ),
      'issuemetadata' => array(
        'label' => 'above',
@@ -938,7 +1002,7 @@ function drupalorg_security_advisories_field_default_field_instances() {
        'module' => 'text',
        'settings' => array(),
        'type' => 'text_default',
        'weight' => 8,
        'weight' => 9,
      ),
      'issuemetadata' => array(
        'label' => 'above',
@@ -1003,7 +1067,7 @@ function drupalorg_security_advisories_field_default_field_instances() {
        'module' => 'text',
        'settings' => array(),
        'type' => 'text_default',
        'weight' => 7,
        'weight' => 8,
      ),
      'issuemetadata' => array(
        'label' => 'above',
@@ -1182,7 +1246,9 @@ function drupalorg_security_advisories_field_default_field_instances() {

  // Translatables
  // Included for use with string extractors like potx.
  t('<a href="https://getcomposer.org/doc/articles/versions.md#writing-version-constraints">Writing Composer version constraints</a>.');
  t('Advisory ID');
  t('Affected versions');
  t('Attribute comment at organization');
  t('Attribute comment for customer');
  t('Attribute this contribution');
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ datestamp = 1616604316
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[field_base][] = field_affected_versions
features[field_base][] = field_is_psa
features[field_base][] = field_sa_advisory_id
features[field_base][] = field_sa_changes
@@ -39,6 +40,7 @@ features[field_instance][] = comment-comment_node_sa-field_attribute_as_voluntee
features[field_instance][] = comment-comment_node_sa-field_attribute_contribution_to
features[field_instance][] = comment-comment_node_sa-field_for_customer
features[field_instance][] = comment-comment_node_sa-field_sa_changes
features[field_instance][] = node-sa-field_affected_versions
features[field_instance][] = node-sa-field_is_psa
features[field_instance][] = node-sa-field_issue_credit
features[field_instance][] = node-sa-field_issue_last_status_change
+3 −0
Original line number Diff line number Diff line
@@ -99,6 +99,9 @@ function drupalorg_security_advisories_strongarm() {
      'related_content' => array(
        'custom_settings' => TRUE,
      ),
      'map_teaser' => array(
        'custom_settings' => TRUE,
      ),
    ),
    'extra_fields' => array(
      'form' => array(