Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This plugin is not supported in the WS Api #4

Open
extorn opened this issue Nov 16, 2020 · 0 comments
Open

This plugin is not supported in the WS Api #4

extorn opened this issue Nov 16, 2020 · 0 comments

Comments

@extorn
Copy link

extorn commented Nov 16, 2020

Firstly, I've made this work by copying and pasting the pwg.categories methods verbartim into my plugin (PiwigoClientExt), then tweaking as below. I had to do this because unfortunately I couldn't see a way of accessing the details about the call (more than just source method name) from within the get_extended_desc method. This code will be released shortly if that will make the proposed fix clearer.

To support this, I propose the following alterations:
To the Piwigo Project
All calls to 'render_category_description' must have parameters changed to allow an array, allowing indication as to whether this item is the subject of the call or just a sub category within the subject (if a category id is provided to categories.getList, then that categoryId would be the subject. If none provided, then none will be the subject).

$render_params = array('isSubject' => $row['id'] == $params['cat_id'], 
                               'text' => $row['name']);

example call

trigger_change(
                    'render_category_name',
                    $row['name'],
                    'ws_categories_getList')
                );

To this project

function get_extended_desc($param1, $params)
{
    if (is_array($params)) {
        // This has been called by our code (It's a string if it hasn't)
        $extDescType = 'subcatify_category_description';
        if($params['isSubject']) {
            $extDescType = 'main_page_category_description';
        }
        return trigger_change(
            'render_category_description',
            $params['text'],
            $extDescType
            );
        //This category                 : main_page_category_description
        //Sub category summary version  : subcatify_category_description
    }
    // NOTE: $param1 is the caller method in the new code (because we pass the other data in the params object),
    //            but the raw description text in the Piwigo Team Code.
    return $param1;
}
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

No branches or pull requests

1 participant