Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
saltonmassally committed May 24, 2017
0 parents commit 5f97acf
Show file tree
Hide file tree
Showing 141 changed files with 6,752 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Drupal-CAC-Modules
Binary file added cac_base/.DS_Store
Binary file not shown.
18 changes: 18 additions & 0 deletions cac_base/cac_base.info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CAC Base
type: module
description: Provides custom utilities to the corporate affair commission modules
package: Corporate Affairs Commission
dependencies:
- drupal:node
- drupal:taxonomy
- drupal:path
- drupal:text
- drupal:serialization
- drupal:rest
- basic_auth
- hal
- facets
- search_api
- search_api_db
core: '8.x'
project: 'cac'
45 changes: 45 additions & 0 deletions cac_base/cac_base.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* @file
* Install file for cac_base.
*/

/**
* Implements hook_install().
*
* We don't want users to be able to delete our company content
* type. So therefore we have to tell Drupal that this is the case. This
* can't be done in the content type's configuration YAML file, so we have to
* do it in code, here.
*
* @ingroup cac_base
*/
function cac_base_install() {
// Do not allow the locked content type to be deleted.
$locked = Drupal::state()->get('node.type.locked');
$locked['company_registration'] = 'company_registration';
$locked['company_contact'] = 'company_contact';
Drupal::state()->set('node.type.locked', $locked);
}

/**
* Implements hook_uninstall().
*
* Our content types will live on in the Drupal installation, even after this
* module is uninstalled. This is a good thing, since it allows the user to
* make decisions about their fate. Therefore we should give the user the
* option of deleting them.
*
* Since we told Drupal that our company is locked, we now have
* to tell it to unlock.
*
* @ingroup cac_base
*/
function cac_base_uninstall() {
// Allow company to be deleted.
$locked = Drupal::state()->get('node.type.locked');
unset($locked['company_registration']);
unset($locked['company_contact']);
Drupal::state()->set('node.type.locked', $locked);
}
3 changes: 3 additions & 0 deletions cac_base/cac_base.links.menu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cac_base.description:
title: Config Node Type Company
route_name: config_cac_base.description
44 changes: 44 additions & 0 deletions cac_base/cac_base.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/**
* @file
* Module file for cac_base.
*/

/**
* @defgroup cac_base Example: Config Node Type
* @ingroup examples
* @{
* A basic example of defining a content type through configuration YAML files.
*
* In this example we create two content types for Drupal 8, using only YAML
* files. Well, mostly only YAML files... One of our content types is locked,
* so the user can't delete it while the module is installed. For this we need
* a very tiny amount of support code.
*
* The simplest way to author the per-type YAML files is to create the content
* types within Drupal and then take the YAML files from the configuration
* directory. Like this:
*
* - Install Drupal 8.
* - Create a new content type at admin/structure/types/add. Let's call it
* 'Nifty Content Type'.
* - Look in sites/default/files/config_[some hex codes]/active/. You'll see
* a file called node.type.nifty_content_type.yml.
* - Copy or move that file to your module's config/ directory.
* - Make sure to remove the uuid information from the YAML files.
*
* You can see two of these YAML files in this module's config/ directory.
*
* If you want to lock a content type created in this way, you'll have to
* implement hook_install() and hook_uninstall(). In hook_install(), you'll
* set the content type to be locked. In hook_uninstall() you'll set the
* content type to be unlocked.
*
* Content types created in this way will remain available after the user has
* uninstalled the module. If you were to fail to set the content type as
* unlocked, the user would not be able to delete it.
*
* @see https://drupal.org/node/2029519
* @}
*/
6 changes: 6 additions & 0 deletions cac_base/cac_base.routing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
config_cac_base.description:
path: 'cac/company_registration'
defaults:
_controller: '\Drupal\cac_base\Controller\NodeTypeCompanyRegistration::description'
requirements:
_permission: 'access content'
Binary file added cac_base/config/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
uuid: 4f73ced1-e7fa-4b9d-ba8a-0963b0f5c96f
langcode: en
status: true
dependencies:
config:
- node.type.company_contact
_core:
default_config_hash: R7lix6ErXvXajfpks4FB24AIfLzQvzvku8Geqk1P52A
id: node.company_contact.promote
field_name: promote
entity_type: node
bundle: company_contact
label: 'Promoted to front page'
description: ''
required: false
translatable: true
default_value:
-
value: 0
default_value_callback: ''
settings:
on_label: 'On'
off_label: 'Off'
field_type: boolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
uuid: 47e961a7-e5da-425e-968c-56f77e4b5538
langcode: en
status: true
dependencies:
config:
- node.type.company_contact
_core:
default_config_hash: zgi7SKjCoj4R1DM5elbo4hT6ExhXP6XV-_8bbm6DSMg
id: node.company_contact.status
field_name: status
entity_type: node
bundle: company_contact
label: 'Publishing status'
description: 'A boolean indicating the published state.'
required: false
translatable: true
default_value:
-
value: 1
default_value_callback: ''
settings:
on_label: 'On'
off_label: 'Off'
field_type: boolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: e63498c5-fe5c-4d31-84b3-4defb77f2fd7
langcode: en
status: true
dependencies:
config:
- node.type.company_contact
_core:
default_config_hash: OLnXjEv2ERwCeH3kpGEUhkU0_BGvFtH8TPyVVuZwfz0
id: node.company_contact.title
field_name: title
entity_type: node
bundle: company_contact
label: Name
description: ''
required: true
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
uuid: 4926b31d-f24d-444d-8fae-5bf887e1ad03
langcode: en
status: true
dependencies:
config:
- node.type.company_legacy_registration
_core:
default_config_hash: 7QEQkQgZCN86HFzLD8qP1elKQxcTgOzvA1y7RsHH5cA
id: node.company_legacy_registration.promote
field_name: promote
entity_type: node
bundle: company_legacy_registration
label: 'Promoted to front page'
description: ''
required: false
translatable: true
default_value:
-
value: 0
default_value_callback: ''
settings:
on_label: 'On'
off_label: 'Off'
field_type: boolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: 7ed74b24-4a1d-49c6-ad6d-caa3fb1e8282
langcode: en
status: true
dependencies:
config:
- node.type.company_legacy_registration
_core:
default_config_hash: Uya8oFw_fH8RV3wxIUe9k6eTY8WQS7arsEFNB-l5244
id: node.company_legacy_registration.title
field_name: title
entity_type: node
bundle: company_legacy_registration
label: 'Company Name'
description: ''
required: true
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
uuid: 397ec978-3794-41d9-8633-bec7276afee4
langcode: en
status: true
dependencies:
config:
- node.type.company_registration
_core:
default_config_hash: s8cL-Tfn-2zOjTI7YDCZHCZU1wqLwEY30b7s70mZ-l8
id: node.company_registration.promote
field_name: promote
entity_type: node
bundle: company_registration
label: 'Promoted to front page'
description: ''
required: false
translatable: true
default_value:
-
value: 0
default_value_callback: ''
settings:
on_label: 'On'
off_label: 'Off'
field_type: boolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: cd8fccf5-1a21-48e7-9746-81c92c14f6e2
langcode: en
status: true
dependencies:
config:
- node.type.company_registration
_core:
default_config_hash: AZyEVtpeuMu6rriCU09NILurpzZTLJC3ck6BmWUDnGo
id: node.company_registration.title
field_name: title
entity_type: node
bundle: company_registration
label: 'Business Name'
description: ''
required: true
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: string
Loading

0 comments on commit 5f97acf

Please sign in to comment.