View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003659 | Composr | core | public | 2018-08-04 23:37 | 2018-08-05 20:39 |
Reporter | Chris Graham | Assigned To | |||
Severity | Feature-request | ||||
Status | non-assigned | Resolution | open | ||
Product Version | |||||
Fixed in Version | |||||
Summary | 0003659: New symbol to read metadata based on CMA hooks | ||||
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. | ||||
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]]; } } | ||||
Tags | No tags attached. | ||||
Time estimation (hours) | 1 | ||||
Sponsorship open | 0 | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2018-08-04 23:37 | Chris Graham | New Issue |