Skip to content

Add page collection attribute method snippets#118

Closed
puka-tchou wants to merge 1 commit intomainfrom
feature/collection-snippets
Closed

Add page collection attribute method snippets#118
puka-tchou wants to merge 1 commit intomainfrom
feature/collection-snippets

Conversation

@puka-tchou
Copy link
Owner

@puka-tchou puka-tchou commented Jan 13, 2026

User description

Description

Adds five new code snippets for accessing page/collection attribute methods in Concrete5.

Changes

  • Added c5getcollectionid - Get the collection ID
  • Added c5getcollectionname - Get the collection name
  • Added c5getcollectiondescription - Get the collection description
  • Added c5getcollectionpath - Get the collection path
  • Added c5getcollectionlink - Get the collection link

Related Issues

Closes #37

Snippets Preview

Each snippet provides quick access to commonly used Concrete5 page/collection methods:


PR Type

Enhancement


Description

  • Add five new Concrete5 collection attribute method snippets

  • Enable quick access to collection ID, name, description, path, link

  • Support flexible object reference via $this->c or $c toggle

  • Follow existing snippet patterns for consistency


Diagram Walkthrough

flowchart LR
  A["PHP Snippets File"] -->|Add Collection Methods| B["c5getcollectionid"]
  A -->|Add Collection Methods| C["c5getcollectionname"]
  A -->|Add Collection Methods| D["c5getcollectiondescription"]
  A -->|Add Collection Methods| E["c5getcollectionpath"]
  A -->|Add Collection Methods| F["c5getcollectionlink"]
Loading

File Walkthrough

Relevant files
Enhancement
php.json
Add five collection attribute method snippets                       

snippets/php.json

  • Added five new code snippets for Concrete5 collection methods
  • Each snippet provides access to collection ID, name, description,
    path, and link
  • Snippets support flexible object reference with ${1|$this->c,$c|}
    toggle syntax
  • All snippets follow consistent pattern with descriptive titles and
    prefixes
+25/-0   

- Add c5getcollectionid snippet
- Add c5getcollectionname snippet
- Add c5getcollectiondescription snippet
- Add c5getcollectionpath snippet
- Add c5getcollectionlink snippet

Resolves #37
@qodo-code-review
Copy link

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟢
🎫 #37
🟢 Add snippet/support to access `$c->getCollectionID()` from the page/collection object.
Add snippet/support to access `$c->getCollectionName()` from the page/collection object.
Add snippet/support to access $c->getCollectionDescription() from the page/collection
object.
Add snippet/support to access `$c->getCollectionPath()` from the page/collection object.
Add snippet/support to access `$c->getCollectionLink()` from the page/collection object.
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link

qodo-code-review bot commented Jan 13, 2026

PR Code Suggestions ✨

Latest suggestions up to b48d5a2

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix invalid PHP operator in snippets

Replace the HTML entity -> with the correct PHP object operator -> in the
snippet bodies to ensure they generate valid code.

snippets/php.json [113-137]

 "Get the collection ID": {
   "prefix": "c5getcollectionid",
-  "body": ["${1|$this->c,$c|}->getCollectionID();"],
+  "body": ["${1|$this->c,$c|}->getCollectionID();"],
   "description": "Get the collection ID"
 },
 "Get the collection name": {
   "prefix": "c5getcollectionname",
-  "body": ["${1|$this->c,$c|}->getCollectionName();"],
+  "body": ["${1|$this->c,$c|}->getCollectionName();"],
   "description": "Get the collection name"
 },
 "Get the collection description": {
   "prefix": "c5getcollectiondescription",
-  "body": ["${1|$this->c,$c|}->getCollectionDescription();"],
+  "body": ["${1|$this->c,$c|}->getCollectionDescription();"],
   "description": "Get the collection description"
 },
 "Get the collection path": {
   "prefix": "c5getcollectionpath",
-  "body": ["${1|$this->c,$c|}->getCollectionPath();"],
+  "body": ["${1|$this->c,$c|}->getCollectionPath();"],
   "description": "Get the collection path"
 },
 "Get the collection link": {
   "prefix": "c5getcollectionlink",
-  "body": ["${1|$this->c,$c|}->getCollectionLink();"],
+  "body": ["${1|$this->c,$c|}->getCollectionLink();"],
   "description": "Get the collection link"
 }
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that the HTML entity -> is used instead of the PHP object operator ->, which would make all the new snippets generate invalid and non-functional PHP code.

High
  • More

Previous suggestions

Suggestions up to commit b48d5a2
CategorySuggestion                                                                                                                                    Impact
General
Use literal PHP arrow operator

Replace the HTML entity > with the literal PHP object operator -> to make the
snippet generate valid PHP code.

snippets/php.json [115]

-"${1|$this->c,$c|}->getCollectionID();"
+"${1|$this->c,$c|}->getCollectionID();"
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a critical bug where the PHP object operator is incorrectly encoded, which would make the new code snippets non-functional.

High
Possible issue
Escape snippet dollar signs

Escape the dollar signs ($) within the snippet body choices to ensure they are
treated as literal characters rather than snippet variables.

snippets/php.json [115]

-"body": ["${1|$this->c,$c|}->getCollectionID();"],
+"body": ["${1|\\$this->c,\\$c|}->getCollectionID();"],
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that the dollar signs in the snippet body must be escaped for the snippet to function as intended, fixing a bug that would make the new snippets unusable.

Medium

Repository owner deleted a comment from qodo-code-review bot Jan 13, 2026
Repository owner deleted a comment from qodo-code-review bot Jan 13, 2026
Repository owner deleted a comment from qodo-code-review bot Jan 13, 2026
@puka-tchou puka-tchou closed this Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the page attributes methods

1 participant