{"id":14070823,"url":"https://github.com/Beakerboy/VBA-Drupal-Library","last_synced_at":"2025-07-30T08:32:52.737Z","repository":{"id":53728214,"uuid":"153616417","full_name":"Beakerboy/VBA-Drupal-Library","owner":"Beakerboy","description":"Allows a user to easily push data from excel spreadsheets into a database configured for the Drupal CMS.","archived":false,"fork":false,"pushed_at":"2023-10-31T17:57:08.000Z","size":129,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-04T12:41:27.336Z","etag":null,"topics":["drupal-8","library","vba-excel"],"latest_commit_sha":null,"homepage":"","language":"VBA","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Beakerboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-18T11:58:03.000Z","updated_at":"2023-10-31T17:52:55.000Z","dependencies_parsed_at":"2024-08-13T07:17:58.938Z","dependency_job_id":null,"html_url":"https://github.com/Beakerboy/VBA-Drupal-Library","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Beakerboy/VBA-Drupal-Library","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beakerboy%2FVBA-Drupal-Library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beakerboy%2FVBA-Drupal-Library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beakerboy%2FVBA-Drupal-Library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beakerboy%2FVBA-Drupal-Library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Beakerboy","download_url":"https://codeload.github.com/Beakerboy/VBA-Drupal-Library/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beakerboy%2FVBA-Drupal-Library/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267835665,"owners_count":24151824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drupal-8","library","vba-excel"],"created_at":"2024-08-13T07:08:06.959Z","updated_at":"2025-07-30T08:32:52.376Z","avatar_url":"https://github.com/Beakerboy.png","language":"VBA","readme":"VBA Drupal Library\n=====================\n\n[![Lint VBA](https://github.com/Beakerboy/VBA-Drupal-Library/actions/workflows/lint_vba.yml/badge.svg?branch=master)](https://github.com/Beakerboy/VBA-Drupal-Library/actions/workflows/lint_vba.yml)\n\n### Interact with Drupal Entities in VBA\nThis Library allows a user to easily move data between excel and a database running the Drupal CMS\n\nFeatures\n--------\n * [DrupalDatabase](#database-class)\n * [DrupalField](#field-class)\n * [DrupalEntity](#entity-class)\n \n  Setup\n-----\n\nImport the files into a spreadsheet using Microsoft Visual Basic for Applications. These scripts also require the [VBA-SQL-Library](https://github.com/Beakerboy/VBA-SQL-Library) for generalized SQL Query Objects. Also the Microsoft Scripting Runtime project must be enabled.\n \n Security\n-----\nA user will need database authentication credentials to access the database.\n\n Usage\n-----\n \n ### Database Class\n The DrupalDatabase object is used to perform actions against the databse using Drupal Entities.\n \n ```vba\n    Private MyDatabase As DrupalDatabase\n    Set MyDatabase = New DrupalDatabase\n    MyDatabase.DSN = \"foodb\"\n    MyDatabase.DBType = \"mssql\"\n    'Open UserForm\n    Login.Show\n    'After Button is pressed assign values\n    MyDatabase.Username = Login.Username\n    MyDatabase.Password = Login.Password\n    Unload Login\n```\n\n### Field Class\nThe DrupaField represents a column in the database. It contains all the meta-information like the data type, length, column name, as well as the value. Inspiration comes from the field definition a module developer uses in a custom Entity file in Drupal.\n * .DataType = __type__\n * .Length = __number__\n * .Value = __value__\n * .FieldName = __name__\n * .IdField = __boolean__\n * .TargetEntity __iDrupalEntity__\n * .Create __type__, __name__, _length_\n\nThe currently supported types are boolean, decimal, integer, password, string, and timestamp.\nThe field class cannot be extended into a custom class at this time.\n\n#### Example\n```vba\n'For a string with a length of 50:\nSet oField = Create_DrupalField\noField.Create \"string\", \"name\", 50\n```\nAfter the Field is configured, a value can be added with ```oField.Value=\"Lorum Ipsum\"```. The value will be validated based on the chosen DataType.\n\n### Entity Class\nThe DrupalEntity class is a parent class for any other Entities, but can be used as-is. Custom Entities can extend this class and add custom properties and methods.\n* .Label = __name__\n* .Table = __dbtable__\n* .ID = __integer__\n* .LabelField = __custom-field__\n* .idField = __custom-field__\n* .AddField __DrupalField__\n* .CreateField __type__, __name__, _length_\n* .CreateEntityReference __filedname__, __DrupalEntity__\n* .SetValue __field__, __value__\n* .GetValue __field__\n* .SetTargetValue __field__, __value__\n* .GetFields\n\nAn example of Extending the Base class is this Drupal User Entity. The id field is named 'uid' and the label field remains as the default 'name'. Two additional fields are added, 'pass' and 'timezone'. We add Properties for the fields, and ensure all the required interface methods are in place. \n```vba\nImplements iDrupalEntity\n\nPrivate oEntity As DrupalEntity\n\nPrivate Sub Class_Initialize()\n    Set oEntity = Create_DrupalEntity\n    \n    Dim Uid As DrupalField\n    Set Uid = Create_DrupalField\n    With Uid\n        .FieldName = \"uid\"\n        .DataType = \"int\"\n        .IdField = True\n    End With\n    With oEntity\n        .Table = \"users\"\n        Set .IdField = Uid\n        .CreateField \"password\", \"pass\"\n        .CreateField \"string\", \"timezone\", 32\n    End With\nEnd Sub\n\nPublic Property Get Timezone() As String\n    Timezone = oEntity.GetValue(\"timezone\")\nEnd Property\n\nPublic Property Let Timezone(sValue As String)\n    oEntity.SetValue \"timezone\", sValue\nEnd Property\n\nPublic Property Let Password(sValue As String)\n    oEntity.SetValue \"pass\", sValue\nEnd Property\n\nPublic Property Let ID(lValue As Long)\n    oEntity.ID = lValue\nEnd Property\n\nPublic Property Get ID() As Long\n    ID = oEntity.ID\nEnd Property\n\nPublic Property Let Label(sValue As String)\n    oEntity.Label = sValue\nEnd Property\n\nPublic Property Get Label() As String\n    Label = oEntity.Label\nEnd Property\n\nPublic Property Get Table() As String\n    Table = oEntity.Table\nEnd Property\n\nPublic Property Get iDrupalEntity_Table()\n    iDrupalEntity_Table = oEntity.Table\nEnd Property\n\nPublic Property Get iDrupalEntity_ID() As Long\n    iDrupalEntity_ID = oEntity.ID\nEnd Property\n\nPublic Property Let iDrupalEntity_ID(lValue As Long)\n    oEntity.ID = lValue\nEnd Property\n\nPublic Property Let iDrupalEntity_Label(vValue As Variant)\n    oEntity.Label = vValue\nEnd Property\n\nPublic Property Get iDrupalEntity_IdField()\n    Set iDrupalEntity_IdField = oEntity.IdField\nEnd Property\n\nPublic Property Get iDrupalEntity_LabelField()\n    Set iDrupalEntity_LabelField = oEntity.LabelField\nEnd Property\n\nPublic Property Get iDrupalEntity_Label()\n    iDrupalEntity_Label = oEntity.Label\nEnd Property\n\nPublic Function iDrupalEntity_GetFields()\n    iDrupalEntity_GetFields = oEntity.GetFields\nEnd Function\n```\nAlternatively, the DrupalEntity class can be used as is. This is sufficient if you do not desire or require custom functions or properties. This Node object has an id field named 'nid', a label field named 'title', a status field, and an entity reference to a user.\n```vba\n    Dim DrupalNode As DrupalEntity\n    Dim Nid As DrupalField\n    Dim Title As DrupalField\n    Dim UserEntity As New DrupalUser\n    \n    Set MyObject = Create_DrupalEntity\n    Set Nid = Create_DrupalField\n    Set Title = Create_DrupalField\n    Set UserEntity = New DrupalUser\n    \n    With Nid\n        .FieldName = \"nid\"\n        .IdField = True\n        .DataType = \"int\"\n    End With\n    \n    With Title\n        .FieldName = \"title\"\n        .DataType = \"string\"\n        .Length = 255\n    End With\n    \n    With MyObject\n        .Table = \"node\"\n        Set .IdField = Nid\n        Set .LabelField = Title\n        .CreateEntityReference \"uid\", UserEntity\n        .CreateField \"boolean\", \"status\"\n    End With\n```\n\n","funding_links":[],"categories":["VBA"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBeakerboy%2FVBA-Drupal-Library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBeakerboy%2FVBA-Drupal-Library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBeakerboy%2FVBA-Drupal-Library/lists"}