Skip to content

Md 1172 - #14

Merged
protitude merged 11 commits into
1.2.xfrom
md-1172
Feb 11, 2026
Merged

Md 1172#14
protitude merged 11 commits into
1.2.xfrom
md-1172

Conversation

@protitude

@protitude protitude commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

Describe context / purpose for this PR

Shentity Tweaks

Issue link

#1172

Any other related PRs?

Link to MultiDev instance

http://md-1172-ucbsub-oit.pantheonsite.io

Attempt to update for multiple tables
Make search work with multiple tables on the same page
Processor: add some more input checking - table_search js: fix node dropdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR applies “Shentity” related tweaks to the module’s Google Sheets integration and the table search behavior, including additional input handling and a cleanup/removal of an unused plugin.

Changes:

  • Add input validation/sanitization to Google Sheets processing, including safer handling of unexpected data.
  • Extend Google Sheets fetching/API to optionally accept a full Google Docs URL for Shentity use cases.
  • Update table search JS to support multiple .table-search instances with unique search inputs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Plugin/GoogleSheetsTopLinks.php Removes the GoogleSheetsTopLinks plugin implementation.
src/Plugin/GoogleSheetsProcess.php Adds validation and sanitization when processing fetched sheet data.
src/Plugin/GoogleSheetsFetch.php Adds optional $shentity mode and sanitization for feed construction.
src/Plugin/GoogleSheetsApi.php Passes through new $shentity parameter to the fetcher.
js/table_search.js Refactors to handle multiple searchable tables with unique input IDs.
Comments suppressed due to low confidence (1)

src/Plugin/GoogleSheetsFetch.php:56

  • When $shentity is TRUE and $key fails the prefix check, $feed becomes NULL but is still passed to new CvsToArray($feed, ','). This will trigger fopen(NULL, 'r') warnings and can lead to downstream warnings when processing $data. Add an early return / fallback ($this->fetchData = []) when $feed is empty or invalid.
  public function __construct($key, $gid, $shift = 0, $shentity = FALSE) {
    if ($shentity) {
      // Check the url starts with 'https://docs.google.com'.
      $feed = !empty($key) && strpos($key, 'https://docs.google.com') === 0 ? $key : NULL;
    }
    else {
      $key = !empty($key) ? Xss::filter($key) : NULL;
      $gid = $gid >= 0 ? $gid : NULL;
      // See https://gist.github.com/pamelafox/770584
      $feed = "https://docs.google.com/spreadsheets/d/$key/pub?gid=$gid&single=true&output=csv";
    }
    // Arrays we'll use later.
    $newArray = [];
    // Do it.
    $this->cvsSheet = new CvsToArray($feed, ',');
    $data = $this->cvsSheet->getBuiltArray();

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread js/table_search.js
Comment thread src/Plugin/GoogleSheetsFetch.php Outdated
Comment thread src/Plugin/GoogleSheetsProcess.php

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

@protitude I've opened a new pull request, #15, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 4 commits February 11, 2026 19:17
Co-authored-by: protitude <695625+protitude@users.noreply.github.com>
Co-authored-by: protitude <695625+protitude@users.noreply.github.com>
Add type validation for $sheet_letters to prevent TypeError in PHP 8+
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@protitude
protitude merged commit cbb5ef7 into 1.2.x Feb 11, 2026
1 check passed
@protitude
protitude deleted the md-1172 branch February 11, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants