#3659 - New symbol to read metadata based on CMA hooks
| Identifier | #3659 |
|---|---|
| Issue type | Feature request or suggestion |
| Title | New symbol to read metadata based on CMA hooks |
| Status | Open |
| Handling member | Deleted |
| Addon | core |
| Description | Implement a new symbol that can read out metadata (e.g. title, or thumbnail URL) for any given content type and ID.
This allows catalogue templates to pull in more complex data about resources being referenced. Make sure it doesn't crash if invalid parameters given, or if there's a failed lookup. Support: - title (gets directly from content lookup function) - url (gets directly from content lookup function) - thumb (gets using thumb_field in CMA metadata) - description (?) - ... many others from CMA hook (category, views, submitter, author, add_time, ...) Make sure all data is returned in string form, as needed by Tempcode. Document the symbol. |
| Steps to reproduce | |
| Additional information | A very basic implementation (not doing most of the above specification) as a proof of concept...
<?php /* Composr Copyright (c) ocProducts, 2004-2016 See text/EN/licence.txt for full licencing information. NOTE TO PROGRAMMERS: Do not edit this file. If you need to make changes, save your changed file to the appropriate *_custom folder **** If you ignore this advice, then your website upgrades (e.g. for bug fixes) will likely kill your changes **** */ /** * @license http://opensource.org/licenses/cpal_1.0 Common Public Attribution License * @copyright ocProducts Ltd * @package core */ /** * Hook class. */ class Hook_symbol_CMA_LOOKUP { /** * Run function for symbol hooks. Searches for tasks to perform. * * @param array $param Symbol parameters * @return string Result */ public function run($param) { $content_type = $param[0]; $content_id = $param[1]; $field = $param[2]; require_code('content'); list(, , $cma_info, $content_row) = content_get_details($content_type, $content_id); return $content_row[$cma_info[$field]]; } } |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
There have been no comments yet