diff --git a/composer.json b/composer.json index 2971f014..8013e265 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "drupal/core-composer-scaffold": "^9.4", "drupal/core-recommended": "^9.4", "drupal/gutenberg": "^2.5", + "drupal/twig_debugger": "^1.1", "drush/drush": "^11.0", "vlucas/phpdotenv": "^5.1", "webflo/drupal-finder": "^1.2" @@ -71,6 +72,9 @@ "drupal-scaffold": { "locations": { "web-root": "web/" + }, + "file-mapping": { + "[web-root]/sites/development.services.yml": false } }, "installer-paths": { diff --git a/composer.lock b/composer.lock index 1dd63d71..6d4c68cf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0185c2be14acbd6a7ae758e6b9e93790", + "content-hash": "f1727b553376d4102e1d033d8e1776cf", "packages": [ { "name": "asm89/stack-cors", @@ -1866,6 +1866,55 @@ "issues": "https://www.drupal.org/project/issues/gutenberg" } }, + { + "name": "drupal/twig_debugger", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/twig_debugger.git", + "reference": "1.1.3" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/twig_debugger-1.1.3.zip", + "reference": "1.1.3", + "shasum": "72cb21a98e49e82164f8f06d9af9a9ac6e2b0596" + }, + "require": { + "drupal/core": "^8 || ^9 || ^10" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "1.1.3", + "datestamp": "1658045471", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Neslee Canil Pinto", + "homepage": "https://www.drupal.org/user/3580850" + } + ], + "description": "Enables Twig Debugging for your website.", + "homepage": "https://www.drupal.org/project/twig_debugger", + "keywords": [ + "Drupal", + "Twig Debugger\n" + ], + "support": { + "source": "https://git.drupalcode.org/project/twig_debugger", + "issues": "https://www.drupal.org/project/issues/twig_debugger" + } + }, { "name": "drush/drush", "version": "11.1.1", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 53cace58..afb06a3b 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2805,6 +2805,58 @@ }, "install-path": "../../web/modules/contrib/gutenberg" }, + { + "name": "drupal/twig_debugger", + "version": "1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/twig_debugger.git", + "reference": "1.1.3" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/twig_debugger-1.1.3.zip", + "reference": "1.1.3", + "shasum": "72cb21a98e49e82164f8f06d9af9a9ac6e2b0596" + }, + "require": { + "drupal/core": "^8 || ^9 || ^10" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "1.1.3", + "datestamp": "1658045471", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "installation-source": "dist", + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Neslee Canil Pinto", + "homepage": "https://www.drupal.org/user/3580850" + } + ], + "description": "Enables Twig Debugging for your website.", + "homepage": "https://www.drupal.org/project/twig_debugger", + "keywords": [ + "Drupal", + "Twig Debugger\n" + ], + "support": { + "source": "https://git.drupalcode.org/project/twig_debugger", + "issues": "https://www.drupal.org/project/issues/twig_debugger" + }, + "install-path": "../../web/modules/contrib/twig_debugger" + }, { "name": "drush/drush", "version": "11.1.1", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index b5216164..778ddc77 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'drupal-composer/drupal-project', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'b04a225eb1066e393a516694f05f64cf18f3fbd5', + 'reference' => '3519d8090b511b6661b0b6b20b557fccf8c77655', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -271,7 +271,7 @@ 'drupal-composer/drupal-project' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'b04a225eb1066e393a516694f05f64cf18f3fbd5', + 'reference' => '3519d8090b511b6661b0b6b20b557fccf8c77655', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -517,6 +517,15 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'drupal/twig_debugger' => array( + 'pretty_version' => '1.1.3', + 'version' => '1.1.3.0', + 'reference' => '1.1.3', + 'type' => 'drupal-module', + 'install_path' => __DIR__ . '/../../web/modules/contrib/twig_debugger', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'drush/drush' => array( 'pretty_version' => '11.1.1', 'version' => '11.1.1.0', diff --git a/web/modules/contrib/component/.gitignore b/web/modules/contrib/component/.gitignore new file mode 100644 index 00000000..3d6fa8d1 --- /dev/null +++ b/web/modules/contrib/component/.gitignore @@ -0,0 +1,3 @@ +# Ignore OS and project files +*.DS_Store +*.idea \ No newline at end of file diff --git a/web/modules/contrib/component/LICENSE.txt b/web/modules/contrib/component/LICENSE.txt new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/web/modules/contrib/component/LICENSE.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/web/modules/contrib/component/README.md b/web/modules/contrib/component/README.md new file mode 100644 index 00000000..ef328c43 --- /dev/null +++ b/web/modules/contrib/component/README.md @@ -0,0 +1,58 @@ +# Component + +Adding JS components to your Drupal site just got a whole lot easier. Just +combine your JS components (any type) with an `info.yml` and put it in the +codebase. Now, your component will be available in Drupal as a block - +automatically! + +You can also add a configuration form to your component so site builders can +modify the component. This component "looks" like any other block, so it can be +used just like a core block. + +JS devs don't need to know PHP or Drupal in order to integrate their components +into the CMS. They just need to setup the `info.yml` file properly. +## Info.yml +The `info.yml` file provides the JS developer with a ton of basic configuration +options. By modifying this file, you can provide static or dynamic parameters, +include additional libraries, and even adjust the cache configuration. See the +code comments on `example_tabs.info.yml` for details. + + name: Widget + machine_name: widget + type: component + core_version_requirement: ^8 || ^9 + js: + widget.js: {} + css: + widget.css: {} +Thats it! Put that info.yml file into a directory with the widget.js and +widget.css, and you now have a component. + +## How it works +We rely on the auto-discovery mechanism built into Drupal to find the `info.yml` +file. This is what is able to find the modules, themes, and profiles in the +codebase. We simply add a new "type" to the mix - a **component** + +A component is a block plugin called `ComponentBlock`. That means it's just an +extension of the block entity in Drupal. So, we can interact with components +just like we do for normal blocks! + +The `info.yml` file tells Drupal what this component is called, where it's +assets are located, and how the block can be configured. The module creates a +library definition for each component, loads any other library dependencies, and +renders the default html to the page. + +When the page loads, it has the html it needs (including custom elements) and +then the JS is run in the browser like normal. +## Contributions +- Inspired by the PDB module (mrjmd/decoupled_blocks) +- Kevin Funk + +## Todo + + +### Backlog +- create some more examples - backbone, other core libraries +- create component_reference module +- create component_browser module? +- create component_builder module? diff --git a/web/modules/contrib/component/component.info.yml b/web/modules/contrib/component/component.info.yml new file mode 100644 index 00000000..05ecae2e --- /dev/null +++ b/web/modules/contrib/component/component.info.yml @@ -0,0 +1,10 @@ +name: Component +type: module +description: 'Easily add JS components to Drupal as blocks, with only a single yml file.' +package: Component +core_version_requirement: ^8 || ^9 + +# Information added by Drupal.org packaging script on 2021-01-28 +version: '1.0.0-rc3' +project: 'component' +datestamp: 1611794827 diff --git a/web/modules/contrib/component/component.links.menu.yml b/web/modules/contrib/component/component.links.menu.yml new file mode 100644 index 00000000..eb66e929 --- /dev/null +++ b/web/modules/contrib/component/component.links.menu.yml @@ -0,0 +1,5 @@ +component.admin_form: + title: 'Components' + route_name: component.admin_form + description: 'Manage the components.' + parent: system.admin_config_development diff --git a/web/modules/contrib/component/component.module b/web/modules/contrib/component/component.module new file mode 100644 index 00000000..a4920b7e --- /dev/null +++ b/web/modules/contrib/component/component.module @@ -0,0 +1,122 @@ + [ + 'render element' => 'elements', + 'variables' => [ + 'html_template' => NULL, + 'content_attributes' => NULL, + ], + ], + ]; +} + +/** + * Implements hook_page_attachment() to add plugin config to drupalSettings. + */ +function component_page_attachments(array &$attachments) { + $config = \Drupal::config('component.admin')->get(); + $attachments['#attached']['drupalSettings']['component']['plugins'] = $config; +} + +/** + * Implements hook_library_info_build(). + * + * Create a Drupal library entry for each component. This is what the + * component uses to load the css/js. + * Eg: 'component/example_tabs' + */ +function component_library_info_build() { + $libraries = []; + + // Get a list of all components. + $discovery = \Drupal::service('component.discovery'); + $component_list = $discovery->getComponents(); + + // Build the library registry for each component. We have to loop + // twice because they are keyed to the type of component (block, library) + // as well as the component machine/name. + foreach ($component_list as $components) { + foreach ($components as $name => $component) { + // Build the library array from the config. + if ($component['js']) { + $libraries[$name]['js'] = _component_build_library($component['js'], $component['subpath']); + } + if ($component['css']) { + $libraries[$name]['css']['component'] = _component_build_library($component['css'], $component['subpath']); + } + if ($component['dependencies']) { + $libraries[$name]['dependencies'] = $component['dependencies']; + } + } + } + + // Replace the dependency for any selected plugins. + $config = \Drupal::config('component.admin')->get(); + foreach ($config as $key => $value) { + unset($libraries[$key]['dependencies']); + $libraries[$key]['dependencies'][] = 'component/' . $value; + } + + return $libraries; +} + +/** + * Helper function to process and build library assets. + * + * @param array $assets + * The asset array for CSS or JS. + * @param string $subpath + * The path to the component parent folder, relative to root. This is + * epected to have a forward slash at the beginning and end already. + */ +function _component_build_library(array $assets, $subpath) { + $processed = []; + foreach ($assets as $asset_file => $asset_data) { + // Allow external assets to use absolute path. + if (!empty($asset_data['type']) && $asset_data['type'] == 'external') { + $asset_path = $asset_file; + } + else { + $asset_path = $subpath . $asset_file; + } + $processed[$asset_path] = $asset_data; + } + + return $processed; +} + +/** + * Implements hook_help(). + */ +function component_help($route_name) { + switch ($route_name) { + case 'help.page.component': + $output = '

' . t('About') . '

'; + $output .= '

' . t('The Component module allows you to add web components to your Drupal site as blocks. All you need to do is to add a YML file for each component with the JS/CSS/HTML files. The Component module has a discovery system that will locate the components and register them in the system as blocks.') . '

'; + $output .= '

' . t('This is designed to be as easy as possible for non-Drupal devlopers to be able to use - no PHP, no Twig, and no Drupalisms are required.') . '

'; + $output .= '

' . t('Usesage') . '

'; + $output .= '
'; + $output .= '
' . t('Adding web components') . '
'; + $output .= '
' . t('A component is simply a colelction of JS, CSS, and HTML packaged for usage in the Drupal site. The components_example module contains examples and sample code to get you started. Just add a *.components.yml file to your component, and you are done.') . '
'; + $output .= '
' . t('Folder naming') . '
'; + $output .= '
' . t('Components are only discovered in active modules and themes, and only if they are in a component subfolder. This is so we can limit the amount of searching in the codebase for performance reasons.') . '
'; + $output .= '
' . t('YML file structure') . '
'; + $output .= '
' . t('There are only two required fields in the YML file - name and description. However, there are several other options available - JS/CSS location (and library confirugation options), HTML location, block caching option, configuration form, dependencies, and component type. See the example_tabs.component.yml file for more information.') . '
'; + $output .= '
' . t('Configuration options') . '
'; + $output .= '
' . t('The YML file can provide configuration options for the site builder using Form API. The file can also contain static configuration items if needed. These configuration items are rendered as data attributes on the div wrapper around the component. This ensures that the component can easily access them from their parent element.') . '
'; + $output .= '
' . t('Component type') . '
'; + $output .= '
' . t('By default, the component module will present components as blocks in the system. However, they can also be presented as a "library" in the system. This is an easy way to add non presentation JS and dependencies into your system. The library will be available as "component/libraryName".') . '
'; + $output .= '
'; + return ['#markup' => $output]; + } +} diff --git a/web/modules/contrib/component/component.routing.yml b/web/modules/contrib/component/component.routing.yml new file mode 100644 index 00000000..e8fca76d --- /dev/null +++ b/web/modules/contrib/component/component.routing.yml @@ -0,0 +1,9 @@ +component.admin_form: + path: 'admin/config/development/component' + defaults: + _form: '\Drupal\component\Form\ComponentAdminForm' + _title: 'Components' + requirements: + _permission: 'access administration pages' + options: + _admin_route: TRUE diff --git a/web/modules/contrib/component/component.services.yml b/web/modules/contrib/component/component.services.yml new file mode 100644 index 00000000..5b5600f0 --- /dev/null +++ b/web/modules/contrib/component/component.services.yml @@ -0,0 +1,13 @@ +services: + logger.channel.component: + parent: logger.channel_base + arguments: ['component'] + component.discovery: + class: \Drupal\component\ComponentDiscovery + arguments: + - '@app.root' + - '@module_handler' + - '@theme_handler' + - '@logger.channel.component' + tags: + - { name: plugin_manager_cache_clear } diff --git a/web/modules/contrib/component/composer.json b/web/modules/contrib/component/composer.json new file mode 100644 index 00000000..e9e08e9b --- /dev/null +++ b/web/modules/contrib/component/composer.json @@ -0,0 +1,21 @@ +{ + "name": "drupal/component", + "description": "Easily add JS components to Drupal as blocks, with only a single yml file.", + "type": "drupal-module", + "homepage": "https://drupal.org/project/component", + "authors": [ + { + "name": "Ron Northcutt (rlnorthcutt)", + "homepage": "https://www.drupal.org/u/rlnorthcutt", + "role": "Maintainer" + } + ], + "support": { + "issues": "https://drupal.org/project/issues/component", + "source": "https://git.drupalcode.org/project/component" + }, + "license": "GPL-2.0-or-later", + "minimum-stability": "dev", + "require": { + } +} \ No newline at end of file diff --git a/web/modules/contrib/component/modules/component_example/README.md b/web/modules/contrib/component/modules/component_example/README.md new file mode 100644 index 00000000..e0f0ebe5 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/README.md @@ -0,0 +1,7 @@ +**Component example** + +This is an example module with components that may be useful +for reference, testing, or for a quick demo. + +##Todo +- Add uninstall hook to remove all instances of blocks. diff --git a/web/modules/contrib/component/modules/component_example/component_example.info.yml b/web/modules/contrib/component/modules/component_example/component_example.info.yml new file mode 100644 index 00000000..7ef253f6 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/component_example.info.yml @@ -0,0 +1,12 @@ +name: Component example +type: module +description: 'An example module with some sample components for reference.' +package: Component +core_version_requirement: ^8 || ^9 +dependencies: + - component:component + +# Information added by Drupal.org packaging script on 2021-01-28 +version: '1.0.0-rc3' +project: 'component' +datestamp: 1611794827 diff --git a/web/modules/contrib/component/modules/component_example/components/example_blank/example_blank.component.yml b/web/modules/contrib/component/modules/component_example/components/example_blank/example_blank.component.yml new file mode 100644 index 00000000..c76091c8 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_blank/example_blank.component.yml @@ -0,0 +1,2 @@ +name: Example blank +description: 'This is a blank component for testing.' diff --git a/web/modules/contrib/component/modules/component_example/components/example_config/example_config.component.yml b/web/modules/contrib/component/modules/component_example/components/example_config/example_config.component.yml new file mode 100644 index 00000000..1caf4132 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_config/example_config.component.yml @@ -0,0 +1,42 @@ +name: Example Config +description: 'Example component showing the form config options available' +enable_field: true +js: + example_config.js: {} +cache: + max-age: 60 +form_configuration: + name: + type: textfield + title: 'Name' + default_value: 'Leonard McCoy' + greeting: + type: select + title: "Greeting" + options: + 'Other': 'Some other title' + 'Dr': 'Dr' + 'Mr': 'Mr' + 'Ms': 'Ms' + 'Mrs': 'Mrs' + default_value: 'Dr' + active: + type: radio + title: 'Active' + interests: + type: checkboxes + title: 'Interests' + options: + 'music': 'Music' + 'art': 'Art' + 'sports': 'Sports' + 'games': 'Games' + 'books': 'Books' + favcolor: + type: color + title: 'Favorite color' + default_value: '#ccccff' + date: + type: date + title: 'Birthday' + default_value: '2227-01-20' diff --git a/web/modules/contrib/component/modules/component_example/components/example_config/example_config.js b/web/modules/contrib/component/modules/component_example/components/example_config/example_config.js new file mode 100644 index 00000000..5e43ba25 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_config/example_config.js @@ -0,0 +1,44 @@ +/** + * Example config custom element. This is an example of how to + * pass component config data from the CMS to the component in JS. + **/ + +class ConfigContainer extends HTMLElement { + + /** + * Custom element constructor. + */ + constructor() { + super(); + // Get the config items from Drupal that are passed as data attributes. + this.config = Object.assign({}, this.parentNode.dataset); + // Convert array + this.config.interests = JSON.parse(this.config.interests); + // Build a table and insert it with the values + let tableData = Object.entries(this.config); + this.appendChild(this.buildTable(tableData)); + } + + /** + * Function to build a table and output the results of an array + */ + buildTable(tableData) { + var table = document.createElement('table'); + var tableBody = document.createElement('tbody'); + // Build a row from each array item + tableData.forEach(function (rowData) { + var row = document.createElement('tr'); + // Build cells for each row + rowData.forEach(function (cellData) { + var cell = document.createElement('td'); + cell.appendChild(document.createTextNode(cellData)); + row.appendChild(cell); + }); + tableBody.appendChild(row); + }); + table.appendChild(tableBody); + return table; + } +} + +customElements.define('config-container', ConfigContainer); diff --git a/web/modules/contrib/component/modules/component_example/components/example_config/index.htm b/web/modules/contrib/component/modules/component_example/components/example_config/index.htm new file mode 100644 index 00000000..f5616a1b --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_config/index.htm @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web/modules/contrib/component/modules/component_example/components/example_react_calc/README.md b/web/modules/contrib/component/modules/component_example/components/example_react_calc/README.md new file mode 100644 index 00000000..0e14a675 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_react_calc/README.md @@ -0,0 +1,34 @@ +## Example React Calculator +This is an example of a calculator being provided as a React component. In this +case we are doing a few interesting things: +- react.min.js and react-dom.min.js are being loaded from a CDN directly +- we are using the in-browser Babel transformer (from a CDN) +- we are adding the babel attribute to the JS file list + +By relying on external libraries, it is possible to build self-contained JS +components in most frameworks and styles, without extending the Component +module. + +### Best practice +It is ideal to precompile your scripts (as normal) before adding to the +codebase. This example uses uncompiled code with the in browser trasnformer so +it is easier to use without needing to precompile. + +If you plan to have multiple components using a library like React (as is +normal), then it would be best to create a Drupal library listing and list that +as a dependency in the info.yml file. This not only allows you to more easily +set and control the versions used for your component library, but it also means +that the JS Aggregation tools in Drupal can more easily manage the files without +duplicates. + +You can create a library with a libraries.info.yml file, or as a "component" +that does very little (called "react_bundle"). Then the library could be +included like this +`dependencies: + - component/react_bundle` + +Additionally, it is possible to use webpack or other methods for packaging, but +keep in mind that we want to reuse shared libraries when possible. + +### Source +https://codepen.io/jlmortola/pen/VPYaEv diff --git a/web/modules/contrib/component/modules/component_example/components/example_react_calc/example_react_calc.component.yml b/web/modules/contrib/component/modules/component_example/components/example_react_calc/example_react_calc.component.yml new file mode 100644 index 00000000..1387ee0d --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_react_calc/example_react_calc.component.yml @@ -0,0 +1,14 @@ +name: Example React Calculator +description: 'Example component using React from a CDN.' +js: + example_react_calc.js: {attributes: { type: 'text/babel' }} +css: + example_react_calc.css: {} +# This component makes use of an existing shared library which is provided by +# another component (library type). This is how to share and manage common +# assets across different components. +dependencies: + - component/example_react_lib +cache: + max-age: 0 +# Inspired by: https://codepen.io/jlmortola/pen/VPYaEv diff --git a/web/modules/contrib/component/modules/component_example/components/example_react_calc/example_react_calc.css b/web/modules/contrib/component/modules/component_example/components/example_react_calc/example_react_calc.css new file mode 100644 index 00000000..7d2c914b --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_react_calc/example_react_calc.css @@ -0,0 +1,142 @@ +.calc_wrapper { + height: 100vh; + display: flex; + flex-direction: column; + display: flex; + align-items: center; +} + +#example_react_calc { + background-color: white; + height: 200px; + display: flex; + width: 100%; + max-width: 280px; + justify-content: center; + border: solid thin #ccc; +} + +#example_react_calc div { + width: 100%; +} + +#example_react_calc .calc { + display: flex; + width: 100%; + max-width: 281px; + flex-direction: column; + align-items: center; + margin-bottom: 0px; + position: relative; + z-index: 1; + background-color: #424654; + opacity: 0.97; +} + +#example_react_calc .filter { + display: flex; + width: 100%; + max-width: 280px; + flex-direction: column; + align-items: center; + margin-bottom: 0px; + background-color: white; + position: relative; + z-index: 2; +} + +#example_react_calc button { + margin: 10px; + min-width: 15%; + max-width: 50px; + height: 40px; + border-radius: 0px; + border: none; + background: none; + color: white; + font-family: roboto; + font-size: 20px; +} + +#example_react_calc .calc > div button { + font-size: 1rem; +} + +#example_react_calc button:hover { + cursor: pointer; +} + +#example_react_calc .pad { + display: flex; + flex-direction: column; + width: 100%; + max-width: 330px; + align-items: center; +} + +#example_react_calc .display { + text-align: right; + font-size: 18px; + font-family: Roboto; + overflow: hidden; + width: 100%; + max-width: 250px; +} + +#example_react_calc .result { + text-align: right; + font-size: 40px; + font-family: Roboto; + display: flex; + justify-content: flex-end; +} + +#example_react_calc .dec { + margin-top: 4px; + font-size: 20px; +} + +#example_react_calc .return { + background-color: #f28a4f; + height: 60px; + width: 100%; + max-width: 280px; + margin: 0px; + z-index: 1; + font-size: 30px; + border: solid thin #999; +} + +#example_react_calc .lastrow { + display: flex; + justify-content: flex-end; + margin-right: 50px; + width: 100%; +} + +#example_react_calc h1 { + font-family: roboto; + color: white; +} + + +#example_react_calc .footer { + margin-top: 20px; + color: white; + font-family: roboto; + text-align: center; +} + +#example_react_calc .afterpad { + background-color: blue; + z-index: 2; + display: flex; + align-items: center; + justify-content: center; + position: relative; + width: 100%; + max-width: 330px; + background-color: #424654; + box-shadow: 4px 4px 10px -2px #000000; + padding: 0 1rem; +} diff --git a/web/modules/contrib/component/modules/component_example/components/example_react_calc/example_react_calc.js b/web/modules/contrib/component/modules/component_example/components/example_react_calc/example_react_calc.js new file mode 100644 index 00000000..bcf2f601 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_react_calc/example_react_calc.js @@ -0,0 +1,217 @@ +let Calc = createReactClass({ + + getInitialState: function () { + return { + display: 0, + result: 0, + decimals: ".00" + } + }, + + setResult: function (updates) { + this.setState(updates) + }, + + render: function () { + let result = this.state.result; + let display = this.state.display; + let decimals = this.state.decimals; + + return ( +
+ + + +
+
+ ) + } +}); + +let op = []; //array for storing numbers +let decimal = true; // to access decimal dot + +let Nums = createReactClass({ + + pusher: function (event) { //will add the button value to op + event.preventDefault(); + let num = event.target.value; + + if (op.length <= 23) { + op += num; + this.props.setResult({ display: op }) + } else { + this.props.setResult({ display: '# of max chars reached' }) + } + + }, + + pusher2: function (event) { // to only have 1 operation chained + event.preventDefault(); + let num = event.target.value; + let last = op.charAt(op.length - 1); + + if (op.length <= 23) { + + if ((last === "+") || (last === '*') || (last === '-') || (last === '/') || (last === '.')) { + } else { + op += num; + decimal = true; + this.props.setResult({ display: op }) + } + } else { + this.props.setResult({ display: '# of max chars reached' }) + } + }, + + pusher3: function (event) { + event.preventDefault(); + let num = event.target.value; + if (op.length <= 23) { + op += num; + op = op.replace(/\-+/g, '-') + decimal = true; + this.props.setResult({ display: op }) + } else { + this.props.setResult({ display: '# of max chars reached' }) + } + + }, + + pusher4: function (event) { // function for the '.' + event.preventDefault(); + let num = event.target.value; + if (op.length <= 23) { + if (decimal) { + op += num; + this.props.setResult({ display: op }) + decimal = false; // when '.', sets decimal to false + } + } + else { + this.props.setResult({ display: '# of max chars reached' }) + } + + }, + + result: function (event) { // will execute the operation inside op + event.preventDefault(); + + let result = eval(op).toFixed(2); + let ind = result.indexOf('.'); + + if (String(result).length <= 11) { + this.props.setResult({ + result: result.slice(0, ind), + decimals: result.slice(ind) + }) + + } + else { + this.props.setResult({ result: 'error', decimals: "" }) + } + }, + + reset: function (event) { + event.preventDefault(); + op = []; + decimal = true; + this.props.setResult({ result: 0, display: 0, decimals: '.00' }); + }, + + delete: function (event) { + event.preventDefault(); + let test = false; // to test if im next to delete a '.' + op = op.slice(0, -1); + this.props.setResult({ display: op }) + console.log(op.indexOf(op.length)); + if (op.charAt(op.length - 1) === '.') { //i know the next char is a '.' + test = true; + } + if (test && (op.charAt(op.length - 2) !== '.')) { // activates decimal when i delete a '.' + decimal = true; + test = false; + console.log(test) + } + + }, + + render: function () { + return ( +
+
+
+
+
+ + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + +
+
+
+
+ +
+ ) + } +}); + +let Display = createReactClass({ + render: function () { + return ( +
+ {this.props.display} +
+ ) + } +}); + + +let Result = createReactClass({ + render: function () { + return ( +
+
{this.props.result}
+
{this.props.decimals}
+
+ ) + } +}); + +let Footer = createReactClass({ + render: function () { + return ( +
+ ) + } +}); + +ReactDOM.render(, + document.getElementById('example_react_calc') +); diff --git a/web/modules/contrib/component/modules/component_example/components/example_react_calc/index.htm b/web/modules/contrib/component/modules/component_example/components/example_react_calc/index.htm new file mode 100644 index 00000000..dda87e24 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_react_calc/index.htm @@ -0,0 +1,3 @@ +
+
+
\ No newline at end of file diff --git a/web/modules/contrib/component/modules/component_example/components/example_react_lib/example_react_lib.component.yml b/web/modules/contrib/component/modules/component_example/components/example_react_lib/example_react_lib.component.yml new file mode 100644 index 00000000..daab7960 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_react_lib/example_react_lib.component.yml @@ -0,0 +1,16 @@ +name: Example React Library +description: 'Example shared library created with the component module.' +# This component is only here to add the shared library for other components +# to use. This will *not* create a block or other entity in the system. +type: 'library' +# This is an example of using external (CDN based) JS files following the same +# method that Drupal core uses. The advantage to using an external file is +# that it doesn't need to be included in the codebase, it can be loaded faster +# from a different domain, and its easy to manage the version. +# The downside to an external JS file is that it can not be used "offline" or +# when there isn't an internet connection. +js: + //unpkg.com/react@16.7.0/umd/react.production.min.js: { type: external, minified: true, crossorigin: anonymous } + //unpkg.com/react-dom@16.7.0/umd/react-dom.production.min.js: { type: external, minified: true, crossorigin: anonymous } + //unpkg.com/create-react-class@15.6.0/create-react-class.min.js : { type: external, minified: true, crossorigin: anonymous } + //unpkg.com/babel-standalone@6/babel.min.js: { type: external, minified: true, crossorigin: anonymous } diff --git a/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.component.yml b/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.component.yml new file mode 100755 index 00000000..47837aaa --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.component.yml @@ -0,0 +1,46 @@ +### THESE FIELDS ARE REQUIRED. ### +name: Example Tabs +description: 'Example tabs' +### THESE FIELDS ARE OPTIONAL. ### +# Put in the way the component should be added to the system. Current +# options are block (default) and library. +type: 'block' +# Add your js and css files. Typically, this is a file included in the +# component folder. However, it can also be an external file. For configuration +# options, see https://www.drupal.org/docs/theming-drupal/adding-stylesheets-css-and-javascript-js-to-a-drupal-theme#libraries-options-details +js: + 'example_tabs.js' : {} +css: + 'example_tabs.css' : {} +# Define any Drupal library dependencies. This includes all core libraries as +# well as any module or theme libraries. If you have a common library across +# your components (like React/Vue), then add that as a Drupal library so it can +# be managed in a single place. +# dependencies: +# - core/jquery +# - module/library +# We will look for an index.htm to load as the template. If that has a different +# name or location, then put that here. +template: 'example_tabs.htm' +# Set to true if you want this component availble for component_field. This is +# false by default. +enable_field: true +# All component configuration is passed to the DOM as data attributes on the +# wrapper around your component. +# Hardcoded or static configuration can be provided to your component +static_configuration: + tab1: 'Info' + tab2: 'Code' + tab3: 'Links' +# Dynamic or form configuration can be provided by Drupal's Form API. Many of +# the form elements can be used. See the example_config for a few examples. +# Full list (not all are supported): https://api.drupal.org/api/drupal/elements/ +form_configuration: + tab4: + type: textfield + title: 'Tab 4' + default_value: 'Example' +# For details on cache options see: +# https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!theme.api.php/group/theme_render/8.2.x#sec_caching +cache: + max-age: 60 diff --git a/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.css b/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.css new file mode 100755 index 00000000..bf049572 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.css @@ -0,0 +1,91 @@ +:root { + --grey-600: #222222; + --grey-700: #181818; + --grey-800: #151515; + --grey-900: #0f0f0f; + --grey-000: #fff; + --grey-100: #d1d1d1; + --grey-200: #bababa; + --red-500: #d93636; + --standard-curve: cubic-bezier(0.4, 0, 0.2, 1); + --deceleration-curve: cubic-bezier(0, 0, 0.2, 1); + --acceleration-curve: cubic-bezier(0.4, 0, 1, 1); + --sharp-curve: cubic-bezier(0.4, 0, 0.6, 1); +} + +.example_tabs { + padding: 2em 0; + box-sizing: border-box; +} + +.example_tabs li { + list-style: none; +} + +.example_tabs a { + display: block; + margin-top: 1em; +} + +/* TAB STYLE */ +.example_tabs tab-container { + display: flex; + flex-direction: column; +} +.example_tabs tab-header { + display: flex; + margin-bottom: 12px; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} +.example_tabs tab-header-item { + position: relative; + padding: 6px 8px 6px; + min-width: 8em; + text-align: center; +} +.example_tabs tab-header-item::before, +.example_tabs tab-header-item::after { + content: ""; + position: absolute; + left: 0; + right: 0; + bottom: 0; + top: 0; + z-index: 100; + border: 0px solid var(--grey-900); + transition: transform 0.2s cubic-bezier(1, 0.6, 0, 1); +} +.example_tabs tab-header-item::before { + bottom: 2px; + border-width: 2px 0 0; + transform: translateY(100%); +} +.example_tabs tab-header-item::after { + right: -1px; + left: -1px; + border-width: 0 2px; + transform-origin: center bottom; + transform: scaleY(0); +} +.example_tabs tab-header-item.tab-active::before { + transform: translateY(0); + transition-timing-function: cubic-bezier(1, 0.6, 0, 1.22); +} +.example_tabs tab-header-item.tab-active::after { + transform: scaleY(1); + transition-timing-function: cubic-bezier(1, 0.6, 0, 1.22); +} +.example_tabs tab-body { + position: relative; + display: flex; + flex-flow: row warp; + flex: 1; + overflow-x: hidden; + width: 100%; +} +.example_tabs tab-body-item { + min-width: 100%; + transition: transform 0.2s cubic-bezier(1, 0.6, 0, 1); +} diff --git a/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.htm b/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.htm new file mode 100755 index 00000000..2e1b82ba --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.htm @@ -0,0 +1,38 @@ + + + Tab1 + Tab2 + Tab3 + Tab4 + + + +

Custom Elements

+

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

+
+ + + + +

Custom Elements

+

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore + magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd + gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing + elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos + et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor + sit amet.

+
+ +

Sample data

+

The parent tab was added from config.

+
+
+
diff --git a/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.js b/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.js new file mode 100755 index 00000000..bbd29011 --- /dev/null +++ b/web/modules/contrib/component/modules/component_example/components/example_tabs/example_tabs.js @@ -0,0 +1,48 @@ +/** + * Example tab custom element. This uses vanilla JS to create a tabbed + * container. Note that this is not wrapped in a behavior because it + * is a self contained custom element that is only rendered when needed. + **/ + +class TabContainer extends HTMLElement { + + /** + * Custom element constructor. + */ + constructor() { + super(); + // Get the config items from Drupal that are passed as data attributes. + this.config = Object.assign({}, this.parentNode.dataset) ; + this.tabs = this.querySelectorAll('tab-header-item'); + this.index = 0; + + // Add the select to each tab and set the tab text from config. + this.tabs.forEach(function (tab, i) { + tab.innerHTML = this.config[tab.id]; + tab.addEventListener('click', this.select.bind(this, i)); + }, this); + } + + /** + * Tab select method + */ + select(index) { + // Escape the function if needed + if (this.index === index || index < 0 || index > this.tabs.length - 1) { + return; + } + + // Change the active class and the current index + this.tabs[this.index].classList.remove('tab-active'); + this.tabs[index].classList.add('tab-active'); + this.index = index; + + // Move the content + for (let item of this.querySelectorAll('tab-body-item')) { + item.style.transform = `translateX(${(-this.index) * 100}%)`; + } + } + +} + +customElements.define('tab-container', TabContainer); diff --git a/web/modules/contrib/component/src/ComponentDiscovery.php b/web/modules/contrib/component/src/ComponentDiscovery.php new file mode 100755 index 00000000..62989a1b --- /dev/null +++ b/web/modules/contrib/component/src/ComponentDiscovery.php @@ -0,0 +1,306 @@ + '', + // Description of the component for the admin UI. + 'description' => '', + // The type of plugin to create with this component. + // Current options are 'block','library', or 'plugin'. + 'type' => 'block', + // JS & CSS files for inclusion as a library for this component. + 'js' => [], + 'css' => [], + // The HTML template to use to render the component. + 'template' => 'index.htm', + // Form configuration for the component in the admin UI. + 'form_configuration' => [], + // Static parameters to be passed to the JS component. + 'static_configuration' => [], + // Set the cache timeout for this component if needed. + 'cache' => ['max-age' => 0], + // Define the library dependencies that this component needs. + 'dependencies' => [], + // Define the machine name of the component that this is going to override. + 'parent' => '', + ]; + + /** + * ComponentDiscovery constructor. + * + * @param string $root + * The root web directory of the Drupal installation. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler. + * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler + * The theme handler. + * @param \Psr\Log\LoggerInterface $logger + * A logger instance. + */ + public function __construct($root, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, LoggerInterface $logger) { + $this->root = $root; + $this->moduleHandler = $module_handler; + $this->themeHandler = $theme_handler; + $this->logger = $logger; + } + + /** + * Generates an array of sort component data. + * + * This is the ONLY public method available via this service. + * + * @return array + * A multidimensional array keyed by the component type first, then by + * component machine name, with the yml data as the values. + */ + public function getComponents() { + // Set up the default array of components. + $components = [ + 'block' => [], + 'library' => [], + 'plugin' => [], + ]; + // Find component yml files. This provides an array of file paths keyed by + // the machine_name (filename) of the component. + $component_files = $this->scan(); + // Process each component file and create the list of components. + foreach ($component_files as $name => $filepath) { + // If the yml is valid and has data, then process it. + if ($file_data = $this->parse($filepath)) { + // Set the defaults and add the component data from the file. + $component_data = array_merge($this->defaults, $file_data); + // Create the component path and subpath (relative to the root). + $path = str_replace($name . '.component.yml', '', $filepath); + $subpath = str_replace($this->root, '', $path); + // Organize the components by type (block, library, override);. + $type = $component_data['type']; + // Build the components return array. + $components[$type][$name] = $component_data; + $components[$type][$name]['machine_name'] = $name; + $components[$type][$name]['path'] = $path; + $components[$type][$name]['subpath'] = $subpath; + } + } + // Allow the component info to be altered. + $this->moduleHandler->alter('component_info', $components); + + return $components; + } + + /** + * Discovers all of the component Yaml files in the system. + * + * This will look in all enambled modules and themes for a "component" + * subdirectory. Then it will check that directory and all subdirectories + * for component Yaml files. + * + * The information is returned in an associative array, keyed by the component + * name (without .component.yml extension). + * + * @return array + * Array of file paths for component.yml files keyed by machine name. + */ + protected function scan() { + $filepaths = []; + // Scan in the proper directories for components. + foreach ($this->getSearchDirs() as $dir) { + // Check for any component yml files, and store their filepath. + if ($component_files = $this->scanDirectory($dir)) { + $filepaths += $component_files; + } + } + // Process and return the list of components keyed by machine name. + return $filepaths; + } + + /** + * Generate an array of directories to search in for components. + * + * We want to only look in the "components" folder of any activated modules + * or themes. + * + * @return array + * Array of paths with a "components" directory in the root. + */ + protected function getSearchDirs() { + $dirs = []; + // Create a list of parent directories to search. Look in all active modules + // and themes. Look in the root as well. + $parents = array_merge($this->moduleHandler->getModuleDirectories(), $this->themeHandler->getThemeDirectories()); + $parents['root'] = $this->root; + // Loop through the possible parent directories. + foreach ($parents as $path) { + // Only return paths that exist. + if (($component_dir = $path . '/components') && is_dir($component_dir)) { + $dirs[] = $component_dir; + } + } + return $dirs; + } + + /** + * Parse a component Yaml file. + * + * @param string $filepath + * The path to the file that needs to be parsed. + * + * @return array + * An array of component data read from the file. + */ + protected function parse($filepath) { + $parsed_data = []; + // Make sure the file exists. + if (file_exists($filepath)) { + // Straight Yaml decode. + // @TODO: test exception + try { + $parsed_data = Yaml::decode(file_get_contents($filepath)); + } + catch (InvalidDataTypeException $e) { + throw new ComponentDiscoveryException( + "Unable to parse {$filepath} " . $e->getMessage() + ); + } + // @TODO : test required keys + // @TODO : right now this kills the site + // Validate that the component has the required keys. + $missing_keys = array_diff($this->required, array_keys($parsed_data)); + if (!empty($missing_keys)) { + unset($parsed_data); + $this->logger->notice('Component parsing error: missing required keys (' . implode(', ', $missing_keys) . ') in ' . $filepath); + } + } + return $parsed_data; + } + + /** + * Recursively scans a base directory for the components it contains. + * + * @param string $dir + * A relative base directory path to scan, without trailing slash. + * + * @return array + * An array of paths with filenames for each component yml. + * + * @see \Drupal\Core\Extension\Discovery\RecursiveExtensionFilterIterator + * @see \Drupal\Core\Extension\ExtensionDiscovery + */ + protected function scanDirectory($dir) { + // Validate that this is a directory worth investigating. + if (!is_dir($dir)) { + return NULL; + } + $files = []; + // ******************** UNLEASH THE KRAKEN ********************. + // We need to create a recursive iterator to crawl the directory and look + // for component yml files. This type of action can be resource intensive. + // For performance reasons, we want to limit the numebr of subdirectories + // that we will search inside of. First we create a filter to do so. + // Use Unix paths regardless of platform, skip dot directories, follow + // symlinks (to allow extensions to be linked from elsewhere), and return + // the RecursiveDirectoryIterator instance to have access to getSubPath(), + // since SplFileInfo does not support relative paths. + $flags = \FilesystemIterator::UNIX_PATHS; + $flags |= \FilesystemIterator::SKIP_DOTS; + $flags |= \FilesystemIterator::FOLLOW_SYMLINKS; + $flags |= \FilesystemIterator::CURRENT_AS_SELF; + $dir_iterator = new \RecursiveDirectoryIterator($dir, $flags); + + // Allow directories specified in settings.php to be ignored. You can use + // this to not check for files in common special-purpose directories. + $ignore_dir = Settings::get('file_scan_ignore_directories', []); + + // Create the filter to use. Note that this is based on ExtensionDiscovery + // We can safely use the same filters for finding info.yml files here. + $filter = new RecursiveComponentFilterIterator($dir_iterator, $ignore_dir); + + // Grab the list of files that have been discovered using the filter above + // to avoid scanning all subdirs. Glad we put a leash on this thing, huh? + $iterator = new \RecursiveIteratorIterator($filter, \RecursiveIteratorIterator::LEAVES_ONLY, \RecursiveIteratorIterator::CATCH_GET_CHILD); + + // Loop through the files found in directory and all valid subdirectories. + foreach ($iterator as $fileinfo) { + // If this isn't a valid component file, then go check the next one. + if (!preg_match(static::PHP_FUNCT_PATTERN, $fileinfo + ->getBasename('.component.yml'))) { + continue; + } + // Set the name of the component and the pathname of where to find it. + $name = $fileinfo->getBasename('.component.yml'); + // Set the full path including the file itself. + $pathfilename = $fileinfo->getPathName(); + // Add the filepath keyed by component machine name. + $files[$name] = $pathfilename; + } + return $files; + } + +} diff --git a/web/modules/contrib/component/src/ComponentDiscoveryException.php b/web/modules/contrib/component/src/ComponentDiscoveryException.php new file mode 100644 index 00000000..a15b9f46 --- /dev/null +++ b/web/modules/contrib/component/src/ComponentDiscoveryException.php @@ -0,0 +1,12 @@ +componentDiscovery = $container->get('component.discovery'); + return $instance; + } + + /** + * {@inheritdoc} + */ + protected function getEditableConfigNames() { + return [ + 'component.admin', + ]; + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'component_admin_form'; + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state) { + // Get a list of components. + $components = $this->componentDiscovery->getComponents(); + // Generate the form or render array for each type. + $form['plugin'] = $this->pluginForm($components); + $form['library'] = $this->componentTable($components['library'], 'Libraries'); + $form['block'] = $this->componentTable($components['block'], 'Blocks'); + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + parent::submitForm($form, $form_state); + + $plugins = $form_state->getValues()['plugins']; + foreach ($plugins as $parent => $value) { + $this->config('component.admin') + ->set($parent, $value['select']) + ->save(); + } + + } + + /** + * Generate the form for the plugins. + */ + protected function pluginForm($components) { + $component_plugins = $components['plugin']; + $form['plugin_title'] = ['#markup' => '

' . $this->t('Plugins') . '

']; + // Check if there are any plugins. + if (count($component_plugins)) { + // Build the options for the plugins. + $plugins = []; + foreach ($component_plugins as $name => $data) { + $parent = $data['parent']; + $plugins[$parent][$name] = $data['name']; + } + // Build a table for the plugins. + $form['plugins'] = $this->pluginTable($plugins); + // Add the save button. + $form['actions']['#type'] = 'actions'; + $form['actions']['submit'] = [ + '#type' => 'submit', + '#value' => $this->t('Save configuration'), + '#button_type' => 'primary', + ]; + + // By default, render the form using system-config-form.html.twig. + $form['#theme'] = 'system_config_form'; + } + else { + // Return a message if not. + $form['component_plugins'] = [ + '#markup' => '

' . $this->t('There are no plugin type components found in the system.') . '

', + ]; + } + return $form; + } + + /** + * Build the plugins table. + */ + protected function pluginTable(array $plugins) { + $table = [ + '#type' => 'table', + '#header' => [ + $this->t('Name'), + $this->t('Plugin to use'), + ], + ]; + // Build each row. + foreach ($plugins as $name => $options) { + $default = $this->config('component.admin')->get($name); + $table[$name]['name'] = [ + '#markup' => '' . $name . '', + ]; + $table[$name]['select'] = [ + '#type' => 'select', + '#title' => $this->t('Select plugin'), + '#options' => $options, + '#default_value' => $default, + ]; + } + return $table; + } + + /** + * Generate the form for the plugins. + */ + protected function componentTable(array $components, string $title) { + ksort($components); + $output = ['#markup' => '

' . $this->t($title) . '

']; + // Create a table to list components. + $table = [ + '#type' => 'table', + '#header' => [ + $this->t('Name'), + $this->t('Machine name'), + $this->t('Description'), + $this->t('Dependencies'), + ], + ]; + // Build each row. + foreach ($components as $name => $component) { + $table[$name]['name'] = [ + '#markup' => '' . $component['name'] . '', + ]; + $table[$name]['machine_name'] = [ + '#markup' => 'component/' . $name . '', + ]; + $table[$name]['description'] = [ + '#markup' => $component['description'], + ]; + $table[$name]['dependencies'] = [ + '#markup' => implode("
", $component['dependencies']), + ]; + } + $output['table'] = $table; + return $output; + } + +} diff --git a/web/modules/contrib/component/src/Plugin/Block/ComponentBlock.php b/web/modules/contrib/component/src/Plugin/Block/ComponentBlock.php new file mode 100644 index 00000000..03199229 --- /dev/null +++ b/web/modules/contrib/component/src/Plugin/Block/ComponentBlock.php @@ -0,0 +1,302 @@ +component = $this->getComponentInfo(); + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition + ); + } + + /** + * {@inheritdoc} + */ + public function build() { + // Attach the css/js files as defined in the info.yml file. + $build['#attached']['library'] = $this->getLibraryName(); + // Grab the template and build the render array. + $build['#theme'] = $this->getThemeHook(); + $build['#html_template'] = $this->getTemplate(); + $build['#content_attributes'] = $this->buildAttributes(); + // Add caching settings. These can be managed from the component.yml file. + $build['#cache'] = $this->getCacheSettings(); + return $build; + } + + /** + * Returns the library name. + * + * @return array + * The library name. This is created by component_library_info_build(). + */ + protected function getLibraryName() { + $show = isset($this->component['js']) || isset($this->component['js']); + return ($show) ? ['component/' . $this->component['machine_name']] : []; + } + + /** + * Returns the HTML template path. + * + * @return string + * The path for the template. Defaults to index.htm + */ + protected function getTemplate() { + $file = $this->component['path'] . $this->component['template']; + return (file_exists($file)) ? file_get_contents($file) : ''; + } + + /** + * Returns the hook_theme name. + * + * @return string + * The hook_theme definition. Defaults to 'component_html' + */ + protected function getThemeHook() { + return (isset($this->component['theme'])) ? $this->component['theme'] : 'component_html'; + } + + /** + * Returns the cache settings. + * + * @return array + * Array with cache settings. Defaults to ['max-age' => 0] + */ + protected function getCacheSettings() { + return $this->component['cache']; + } + + /** + * Returns the component definition. + * + * @return array + * The component definition. + */ + protected function getComponentInfo() { + $plugin_definition = $this->getPluginDefinition(); + return $plugin_definition['info']; + } + + /** + * Create the data attributes for the wrapper div wround the component. + * + * @return array + * A unique id, machine name as class, and all of the component + * configuration options from the CMS. We pass the component configuration + * into the DOM through the data attributes in the wrapper around the + * component HTML. + */ + protected function buildAttributes() { + $component = $this->component; + // @TODO: This unique id and name should be set on the object and generated + // once only. This will have a new UUID per render. Can we use an internal + // drupal uuid that is already generated by the plugin instance? + $uuid = \Drupal::service('uuid')->generate(); + // Add a unique ID and machine name as class. + $attributes = [ + 'id' => $component['machine_name'] . '-' . $uuid, + 'class' => $component['machine_name'], + ]; + // Write the config as data attributes on the wrapper. + $data = $this->getComponentConfig(); + foreach ($data as $key => $value) { + // JSON encode arrays and use single quotes. + $value = is_array($value) ? json_encode($value) : $value; + $attributes['data-' . str_replace('_', '-', $key)] = $value; + } + return $attributes; + } + + /** + * Returns the component configuration data. + * + * @return array + * The component configuration data. + */ + protected function getComponentConfig() { + $data = []; + // Add static config if it exists. + $component = $this->component; + if (isset($component['static_configuration'])) { + $data = $component['static_configuration']; + } + // Add form config if it exists. + if (isset($this->configuration['form_configuration'])) { + $data += $this->configuration['form_configuration']; + } + // Simplify and clean up arrays. Remove blank values and keys. + foreach ($data as $key => $value) { + if (is_array($value)) { + $data[$key] = array_values(array_filter($value)); + } + } + return $data; + } + + /** + * {@inheritdoc} + */ + public function buildConfigurationForm(array $form, FormStateInterface $form_state) { + $form = parent::buildConfigurationForm($form, $form_state); + $form['form_configuration'] = $this->buildComponentFormSettingsForm($form_state); + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { + parent::submitConfigurationForm($form, $form_state); + $this->configuration['form_configuration'] = $form_state->getValue('form_configuration'); + } + + /** + * Build settings form configuration settings form. + * + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The form state array. + * + * @return array + * Form elements. + */ + protected function buildComponentFormSettingsForm(FormStateInterface $form_state) { + $definition = $this->getPluginDefinition(); + $elements = []; + if (isset($definition['info']['form_configuration'])) { + $elements = $this->createElementsFromFormConfiguration($definition['info']['form_configuration'], $form_state); + $elements['#title'] = $this->t('Component Settings'); + $elements['#type'] = 'details'; + $elements['#open'] = TRUE; + $elements['#tree'] = TRUE; + } + return $elements; + } + + /** + * Create Form API elements from component configuration. + * + * @param array $configuration + * The configuration array. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The form state array. + * + * @return array + * Form elements. + */ + protected function createElementsFromFormConfiguration(array $configuration, FormStateInterface $form_state) { + $elements = []; + $defaults = (!empty($this->configuration['form_configuration'])) ? + $this->configuration['form_configuration'] : []; + foreach ($configuration as $key => $setting) { + $element = []; + foreach ($setting as $property_key => $property) { + // @todo Create whitelist or blacklist of form api properties. + $element["#$property_key"] = $property; + } + if (isset($defaults[$key])) { + $element['#default_value'] = $defaults[$key]; + } + $elements[$key] = $element; + } + return $elements; + } + + /** + * Investigate and refactor the methods below. + * + * @todo + */ + + /** + * Add serialized entity to the JS Contexts. + * + * @param \Drupal\Core\Entity\Plugin\DataType\EntityAdapter $data + * The entity to serialize. + * @param array $js_contexts + * The full array of JS contexts. + * @param string $key + * The context key. + */ + protected function addEntityJsContext(EntityAdapter $data, array &$js_contexts, $key) { + $entity = $data->getValue(); + $entity_access = $entity->access('view', NULL, TRUE); + if (!$entity_access->isAllowed()) { + return; + } + foreach ($entity as $field_name => $field) { + /** @var \Drupal\Core\Field\FieldItemListInterface $field */ + $field_access = $field->access('view', NULL, TRUE); + + // @todo Used addCacheableDependency($field_access); + if (!$field_access->isAllowed()) { + $entity->set($field_name, NULL); + } + } + + $js_contexts["$key:" . $entity->getEntityTypeId()] = $entity->toArray(); + } + + /** + * Get an array of serialized JS contexts. + * + * @param \Drupal\Component\Plugin\Context\ContextInterface[] $contexts + * The contexts to serialize. + * + * @return array + * An array of serialized JS contexts. + */ + protected function getJsContexts(array $contexts) { + $js_contexts = []; + foreach ($contexts as $key => $context) { + $data = $context->getContextData(); + if ($data instanceof EntityAdapter) { + $this->addEntityJsContext($data, $js_contexts, $key); + } + } + return $js_contexts; + } + +} diff --git a/web/modules/contrib/component/src/Plugin/Derivative/ComponentBlockDeriver.php b/web/modules/contrib/component/src/Plugin/Derivative/ComponentBlockDeriver.php new file mode 100644 index 00000000..5aa4d74c --- /dev/null +++ b/web/modules/contrib/component/src/Plugin/Derivative/ComponentBlockDeriver.php @@ -0,0 +1,81 @@ +componentDiscovery = $component_discovery; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, $base_plugin_id) { + return new static( + $container->get('component.discovery') + ); + } + + /** + * {@inheritdoc} + */ + public function getDerivativeDefinitions($base_plugin_definition) { + // Get a list of components. + $components = $this->componentDiscovery->getComponents(); + // Just check the block type components. + foreach ($components['block'] as $name => $component) { + $this->derivatives[$name] = $base_plugin_definition; + $this->derivatives[$name]['info'] = $component; + $this->derivatives[$name]['admin_label'] = $component['name']; + $this->derivatives[$name]['cache'] = $component['cache']; + if (isset($component['contexts'])) { + $this->derivatives[$name]['context'] = $this->createContexts($component['contexts']); + } + } + return $this->derivatives; + } + + /** + * Creates the context definitions required by a block plugin. + * + * @param array $contexts + * Contexts as defined in component label. + * + * @return \Drupal\Core\Plugin\Context\ContextDefinition[] + * Array of context to be used by block module + * + * @todo where is this defined in block module + */ + protected function createContexts(array $contexts) { + $contexts_definitions = []; + if (isset($contexts['entity'])) { + // @todo Check entity type exists and fail! + $contexts_definitions['entity'] = new ContextDefinition('entity:' . $contexts['entity']); + } + // @todo Dynamically handle unknown context definitions + return $contexts_definitions; + } + +} diff --git a/web/modules/contrib/component/src/RecursiveComponentFilterIterator.php b/web/modules/contrib/component/src/RecursiveComponentFilterIterator.php new file mode 100644 index 00000000..39c85b03 --- /dev/null +++ b/web/modules/contrib/component/src/RecursiveComponentFilterIterator.php @@ -0,0 +1,117 @@ +blocklist = array_merge($this->blocklist, $blocklist); + } + + /** + * Controls whether test directories will be scanned. + * + * @param bool $flag + * Pass FALSE to skip all test directories in the discovery. If TRUE, + * components in test directories will be discovered and only the global + * directory blocklist in RecursiveComponentFilterIterator::$blocklist is + * applied. + */ + public function acceptTests($flag = FALSE) { + $this->acceptTests = $flag; + if (!$this->acceptTests) { + $this->blocklist[] = 'tests'; + } + } + + /** + * {@inheritdoc} + */ + public function getChildren() { + $filter = parent::getChildren(); + // Pass on the blocklist. + $filter->blocklist = $this->blocklist; + // Pass the $acceptTests flag forward to child iterators. + $filter->acceptTests($this->acceptTests); + return $filter; + } + + /** + * {@inheritdoc} + */ + public function accept() { + $name = $this->current()->getFilename(); + // FilesystemIterator::SKIP_DOTS only skips '.' and '..', but not hidden + // directories (like '.git'). + if ($name[0] == '.') { + return FALSE; + } + if ($this->isDir()) { + // Accept the directory unless the name is blocklisted. + return !in_array($name, $this->blocklist, TRUE); + } + else { + // Only accept component yml files. + return substr($name, -14) == '.component.yml'; + } + } + +} diff --git a/web/modules/contrib/component/templates/component-html.html.twig b/web/modules/contrib/component/templates/component-html.html.twig new file mode 100755 index 00000000..670b1d8e --- /dev/null +++ b/web/modules/contrib/component/templates/component-html.html.twig @@ -0,0 +1,13 @@ +{# +/** + * @file + * Template for Component HTML. + * + * Available variables: + * - html_template: Component html file.. + */ +#} + + + {{ html_template|raw }} + diff --git a/web/modules/contrib/twig_debugger/LICENSE.txt b/web/modules/contrib/twig_debugger/LICENSE.txt new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/web/modules/contrib/twig_debugger/LICENSE.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/web/modules/contrib/twig_debugger/README.txt b/web/modules/contrib/twig_debugger/README.txt new file mode 100644 index 00000000..a1b6e129 --- /dev/null +++ b/web/modules/contrib/twig_debugger/README.txt @@ -0,0 +1,34 @@ +CONTENTS OF THIS FILE +--------------------- + + * Introduction + * Requirements + * Installation + * Configuration + * Maintainers + + +INTRODUCTION +------------ +Enables Twig Debugging for your website. + + +REQUIREMENTS +------------ +This module does not have any dependency on any other module. + + +INSTALLATION +------------ +Install as normal (see http://drupal.org/documentation/install/modules-themes). + + +CONFIGURATION +------------- +You can configure this module at /admin/config/development/twig-debugger, +By checking the checkbox twig debugging will be enabled on your site. + + +MAINTAINERS +----------- +Neslee Canil Pinto: https://www.drupal.org/u/neslee-canil-pinto diff --git a/web/modules/contrib/twig_debugger/composer.json b/web/modules/contrib/twig_debugger/composer.json new file mode 100644 index 00000000..f57819bc --- /dev/null +++ b/web/modules/contrib/twig_debugger/composer.json @@ -0,0 +1,15 @@ +{ + "name": "drupal/twig_debugger", + "type": "drupal-module", + "description": "Enables Twig Debugging for your website.", + "keywords": ["Drupal", "Twig Debugger\n"], + "license": "GPL-2.0-or-later", + "homepage": "https://www.drupal.org/project/twig_debugger", + "support": { + "issues": "https://www.drupal.org/project/issues/twig_debugger", + "source": "https://git.drupalcode.org/project/twig_debugger" + }, + "require": { + "drupal/core": "^8 || ^9 || ^10" + } +} diff --git a/web/modules/contrib/twig_debugger/src/Form/TwigDebugger.php b/web/modules/contrib/twig_debugger/src/Form/TwigDebugger.php new file mode 100644 index 00000000..0237cb36 --- /dev/null +++ b/web/modules/contrib/twig_debugger/src/Form/TwigDebugger.php @@ -0,0 +1,80 @@ +config('twig_debugger.settings'); + $form['configuration'] = [ + '#type' => 'fieldset', + '#title' => $this->t('Twig Debugger Configuration'), + ]; + $form['configuration']['enabled'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Enable Twig Debugging'), + '#default_value' => $config->get('enabled'), + '#description' => $this->t('If checked/ticked, twig debugging will be enable for the site.'), + ]; + return parent::buildForm($form, $form_state); + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $this->config('twig_debugger.settings') + ->set('enabled', trim($form_state->getValue('enabled'))) + ->save(); + if ($form_state->getValue('enabled') === 1) { + $destination = DRUPAL_ROOT . '/sites/default/services.yml'; + if (file_exists($destination) === FALSE) { + $source = DRUPAL_ROOT . '/sites/default/default.services.yml'; + chmod(DRUPAL_ROOT . '/sites/default', 0777); + touch($destination); + copy($source, $destination); + chmod(DRUPAL_ROOT . '/sites/default', 0555); + file_put_contents($destination, str_replace('debug: false', 'debug: true', file_get_contents($destination))); + file_put_contents($destination, str_replace('auto_reload: null', 'auto_reload: true', file_get_contents($destination))); + file_put_contents($destination, str_replace('cache: true', 'cache: false', file_get_contents($destination))); + drupal_flush_all_caches(); + } + } + else { + $source = DRUPAL_ROOT . '/sites/default/services.yml'; + if (file_exists($source) === TRUE) { + chmod(DRUPAL_ROOT . '/sites/default', 0777); + unlink($source); + chmod(DRUPAL_ROOT . '/sites/default', 0555); + drupal_flush_all_caches(); + } + } + parent::submitForm($form, $form_state); + } + +} diff --git a/web/modules/contrib/twig_debugger/twig_debugger.info.yml b/web/modules/contrib/twig_debugger/twig_debugger.info.yml new file mode 100644 index 00000000..510c10b3 --- /dev/null +++ b/web/modules/contrib/twig_debugger/twig_debugger.info.yml @@ -0,0 +1,12 @@ +name: 'Twig Debugger' +type: module +description: 'Enables Twig Debugging for your website' +package: Other +core: 8.x +core_version_requirement: ^8 || ^9 || ^10 +configure: twig_debugger.settings + +# Information added by Drupal.org packaging script on 2022-07-17 +version: '1.1.3' +project: 'twig_debugger' +datestamp: 1658045461 diff --git a/web/modules/contrib/twig_debugger/twig_debugger.links.menu.yml b/web/modules/contrib/twig_debugger/twig_debugger.links.menu.yml new file mode 100644 index 00000000..dfd67911 --- /dev/null +++ b/web/modules/contrib/twig_debugger/twig_debugger.links.menu.yml @@ -0,0 +1,5 @@ +twig_debugger.settings: + title: 'Twig Debugger' + parent: system.admin_config_development + description: 'Configure Twig Debugger settings.' + route_name: twig_debugger.settings diff --git a/web/modules/contrib/twig_debugger/twig_debugger.permissions.yml b/web/modules/contrib/twig_debugger/twig_debugger.permissions.yml new file mode 100644 index 00000000..862b8688 --- /dev/null +++ b/web/modules/contrib/twig_debugger/twig_debugger.permissions.yml @@ -0,0 +1,2 @@ +administer twig debugger configuration: + title: 'Administer twig debugger settings' diff --git a/web/modules/contrib/twig_debugger/twig_debugger.routing.yml b/web/modules/contrib/twig_debugger/twig_debugger.routing.yml new file mode 100644 index 00000000..60c19a5d --- /dev/null +++ b/web/modules/contrib/twig_debugger/twig_debugger.routing.yml @@ -0,0 +1,7 @@ +twig_debugger.settings: + path: '/admin/config/development/twig-debugger' + defaults: + _form: '\Drupal\twig_debugger\Form\TwigDebugger' + _title: 'Twig Debugger Configuration' + requirements: + _permission: 'administer twig debugger configuration' diff --git a/web/sites/development.services.yml b/web/sites/development.services.yml index d2857c66..0553016c 100644 --- a/web/sites/development.services.yml +++ b/web/sites/development.services.yml @@ -4,6 +4,10 @@ # 'example.settings.local.php' file, which sits next to this file. parameters: http.response.debug_cacheability_headers: true + twig.config: + debug: true + auto_reload: true + cache: false services: cache.backend.null: class: Drupal\Core\Cache\NullBackendFactory diff --git a/web/themes/gcc_theme/css/style.css b/web/themes/gcc_theme/css/style.css new file mode 100644 index 00000000..f5a232b7 --- /dev/null +++ b/web/themes/gcc_theme/css/style.css @@ -0,0 +1,50 @@ +body { + background-color: dodgerblue; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; +} +h1 { + color:darkgreen; +} +.header { + background-color: white; + max-height: 10%; + max-width: 100%; +} +.header div { + display: inline-flex; +} +.logo img { + width: 50px; + height: 50px; + display: inline-block; +} +.logo { + max-width: 100%; + max-height: 10%; + background-color: white; +} +.logo a { + font-size: 30pt; + color: green; + text-decoration: none; + padding: 14px 5px; + display: inline-block; +} +img { + max-width: 100%; + max-height: 100%; +} +.main { + max-height: 80%; + max-width: 100%; + display: block; +} +.header ul li { + display: inline-block; + padding: 1px 10px 1px 20px; +} +.header #block-gcc-theme-search-form-wide { + position: absolute; + right: 10px; + padding: 10px; +} \ No newline at end of file diff --git a/web/themes/gcc_theme/favicon.ico b/web/themes/gcc_theme/favicon.ico new file mode 100644 index 00000000..321ccfed Binary files /dev/null and b/web/themes/gcc_theme/favicon.ico differ diff --git a/web/themes/gcc_theme/gcc_theme.info.yml b/web/themes/gcc_theme/gcc_theme.info.yml new file mode 100644 index 00000000..fbea6dea --- /dev/null +++ b/web/themes/gcc_theme/gcc_theme.info.yml @@ -0,0 +1,14 @@ +name: GCC Theme +type: theme +description: 'theme for the GCC website' +base theme: false +core_version_requirement: ^8 || ^9 +libraries: + - gcc_theme/global-styling +regions: + header: 'Header' + logo: 'Logo' + content: 'Content' + footer: 'Footer' + sidebar_first: 'Left Sidebar' + primary_menu: 'Primary Menu' \ No newline at end of file diff --git a/web/themes/gcc_theme/gcc_theme.libraries.yml b/web/themes/gcc_theme/gcc_theme.libraries.yml new file mode 100644 index 00000000..65b2b507 --- /dev/null +++ b/web/themes/gcc_theme/gcc_theme.libraries.yml @@ -0,0 +1,4 @@ +global-styling: + css: + theme: + css/style.css: {} \ No newline at end of file diff --git a/web/themes/gcc_theme/logo.svg b/web/themes/gcc_theme/logo.svg new file mode 100644 index 00000000..3f29a87f --- /dev/null +++ b/web/themes/gcc_theme/logo.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/themes/gcc_theme/templates/html.html.twig b/web/themes/gcc_theme/templates/html.html.twig new file mode 100644 index 00000000..4fe57a01 --- /dev/null +++ b/web/themes/gcc_theme/templates/html.html.twig @@ -0,0 +1,55 @@ +{# +/** + * @file + * Theme override for the basic structure of a single Drupal page. + * + * Variables: + * - logged_in: A flag indicating if user is logged in. + * - root_path: The root path of the current page (e.g., node, admin, user). + * - node_type: The content type for the current node, if the page is a node. + * - head_title: List of text elements that make up the head_title variable. + * May contain one or more of the following: + * - title: The title of the page. + * - name: The name of the site. + * - slogan: The slogan of the site. + * - page_top: Initial rendered markup. This should be printed before 'page'. + * - page: The rendered page markup. + * - page_bottom: Closing rendered markup. This variable should be printed after + * 'page'. + * - db_offline: A flag indicating if the database is offline. + * - placeholder_token: The token for generating head, css, js and js-bottom + * placeholders. + * + * @see template_preprocess_html() + */ +#} +{% + set body_classes = [ + logged_in ? 'user-logged-in', + not root_path ? 'path-frontpage' : 'path-' ~ root_path|clean_class, + node_type ? 'page-node-type-' ~ node_type|clean_class, + db_offline ? 'db-offline', + ] +%} + + + + + {{ head_title|safe_join(' | ') }} + + + + + {# + Keyboard navigation/accessibility link to main content section in + page.html.twig. + #} + + {{ page_top }} + {{ page }} + {{ page_bottom }} + + + diff --git a/web/themes/gcc_theme/templates/page--front.html.twig b/web/themes/gcc_theme/templates/page--front.html.twig new file mode 100644 index 00000000..862650c0 --- /dev/null +++ b/web/themes/gcc_theme/templates/page--front.html.twig @@ -0,0 +1,71 @@ +{# +/** + * @file + * Default theme implementation to display a single page. + * + * The doctype, html, head and body tags are not in this template. Instead they + * can be found in the html.html.twig template in this directory. + * + * Available variables: + * + * General utility variables: + * - base_path: The base URL path of the Drupal installation. Will usually be + * "/" unless you have installed Drupal in a sub-directory. + * - is_front: A flag indicating if the current page is the front page. + * - logged_in: A flag indicating if the user is registered and signed in. + * - is_admin: A flag indicating if the user has permission to access + * administration pages. + * + * Site identity: + * - front_page: The URL of the front page. Use this instead of base_path when + * linking to the front page. This includes the language domain or prefix. + * + * Page content (in order of occurrence in the default page.html.twig): + * - messages: Status and error messages. Should be displayed prominently. + * - node: Fully loaded node, if there is an automatically-loaded node + * associated with the page and the node ID is the second argument in the + * page's path (e.g. node/12345 and node/12345/revisions, but not + * comment/reply/12345). + * + * Regions: + * - page.header: Items for the header region. + * - page.primary_menu: Items for the primary menu region. + * - page.secondary_menu: Items for the secondary menu region. + * - page.highlighted: Items for the highlighted content region. + * - page.help: Dynamic help text, mostly for admin pages. + * - page.content: The main content of the current page. + * - page.sidebar_first: Items for the first sidebar. + * - page.sidebar_second: Items for the second sidebar. + * - page.footer: Items for the footer region. + * - page.breadcrumb: Items for the breadcrumb region. + * + * @see template_preprocess_page() + * @see html.html.twig + * + * @ingroup themeable + */ +#} +
+ + + + + + +
+
+ {{ page.content }} +
+ +
+
+ +
+ +
{# /.layout-container #} diff --git a/web/themes/gcc_theme/templates/page.html.twig b/web/themes/gcc_theme/templates/page.html.twig new file mode 100644 index 00000000..825ac614 --- /dev/null +++ b/web/themes/gcc_theme/templates/page.html.twig @@ -0,0 +1,70 @@ +{# +/** + * @file + * Default theme implementation to display a single page. + * + * The doctype, html, head and body tags are not in this template. Instead they + * can be found in the html.html.twig template in this directory. + * + * Available variables: + * + * General utility variables: + * - base_path: The base URL path of the Drupal installation. Will usually be + * "/" unless you have installed Drupal in a sub-directory. + * - is_front: A flag indicating if the current page is the front page. + * - logged_in: A flag indicating if the user is registered and signed in. + * - is_admin: A flag indicating if the user has permission to access + * administration pages. + * + * Site identity: + * - front_page: The URL of the front page. Use this instead of base_path when + * linking to the front page. This includes the language domain or prefix. + * + * Page content (in order of occurrence in the default page.html.twig): + * - messages: Status and error messages. Should be displayed prominently. + * - node: Fully loaded node, if there is an automatically-loaded node + * associated with the page and the node ID is the second argument in the + * page's path (e.g. node/12345 and node/12345/revisions, but not + * comment/reply/12345). + * + * Regions: + * - page.header: Items for the header region. + * - page.primary_menu: Items for the primary menu region. + * - page.secondary_menu: Items for the secondary menu region. + * - page.highlighted: Items for the highlighted content region. + * - page.help: Dynamic help text, mostly for admin pages. + * - page.content: The main content of the current page. + * - page.sidebar_first: Items for the first sidebar. + * - page.sidebar_second: Items for the second sidebar. + * - page.footer: Items for the footer region. + * - page.breadcrumb: Items for the breadcrumb region. + * + * @see template_preprocess_page() + * @see html.html.twig + * + * @ingroup themeable + */ +#} +
+ + + + + +
+
+ {{ page.content }} +
+ +
+ + +
{# /.layout-container #}