tombenner / wp-mvc

An MVC framework for WordPress
http://wpmvc.org
MIT License
624 stars 172 forks source link

Several changes #241

Closed mcmx closed 4 years ago

mcmx commented 5 years ago

Passed total_objects from collection to pagination, so one can show in a list (or table) how many items were found.

Modified admin_header_cell to append a class to "manage-column", in this case I chose " wpmvc-actions" (watch the leading whitespace so the append to manage-column works as 2 separate classes, basically I needed this to have this in a print.css, to hide the actions column in a table:

.wpmvc-actions { display: none; }

In the call to add_settings_field I added $setting['args'] in this case we can pass additional arguments to the settings, I use it to pass label_for so the display of settings is cleaner example:

class AppointmentSettings extends MvcSettings {
    var $settings = array(
....
       'notification_host' => array(
            'type' => 'text',
            'args' => array('label_for' => 'notification_host'),
            'label' => 'Email server',
        )
);
}

Other changes are basically in translation and testing with isset before using.

$this->helper->plugin_name in pluggable/views/admin/index.php allows me to use my own plugin's name for translation purposes in admin views instead or using wpmvc.

For mvc_settings.php getting plugin_name from the registry I took similar code from core/helpers/mvc_helper.php

Ps. These changes are from 2017 but wanted to send a PR, I believe they won't break anything hopefully

cyberscribe commented 5 years ago

"I believe they won't break anything hopefully" isn't terribly reassuring. Can you let me know how yo have tested this so far?

cyberscribe commented 5 years ago

Also the preferred method for checking a variable is empty rather than isset please.