Route Pages going somewhere 05

Following on from a previous post I’ve removed more UI controls not applicable to route-generated posts and pages.

No Quick Edit

While the possibility is a comfort for “normal” posts and pages it does not apply to route pages (or route-generated posts in general); removing the UI controls tied to the Quick Edit function has been a walk in the park. After hooking a new RoutePages_UIController_QuickEdit class in the main plugin file

// file RoutePages.php

/**
 * Hook into actions and filters here
 *
 */
public function hook()
{
    $editFormAdvancedController = new RoutePages_UIController_EditFormAdvanced();
    $editFormAdvancedController->hook();
    $quickEditController = new RoutePages_UIController_QuickEdit();
    $quickEditController->hook();
}

I’ve set the hooks to remove non relevant quick links in the filterQuickEditActions method for both pages and posts

public function hook()
{
    $this->f->add_filter('post_row_actions', array($this, 'filterQuickEditActions'), 10, 2);
    $this->f->add_filter('page_row_actions', array($this, 'filterQuickEditActions'), 10, 2);
}

public function filterQuickEditActions($actions, $post)
{
    if (!$this->pageManager->isAGeneratedPost($post)) {
        return $actions;
    }
    if (!is_array($actions)) {
        return $actions;
    }

    // this is the "Quick Edit" link
    unset($actions['inline hide-if-no-js']);
    unset($actions['untrash']);
    unset($actions['trash']);
    unset($actions['delete']);
    $actions = array_values($actions);

    return $actions;
}

and ended up with a clean quick link list Normal page quick edit options Route-generate page quick edit options Normal post quick edit options Route-generated post quick edit options

Next

I will be tackling cron-based route-pages generation and add more tests for the plugin pre-requisites.