Download the PHP package roelmagdaleno/wp-settings-page-fields without Composer

On this page you can find all versions of the php package roelmagdaleno/wp-settings-page-fields. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-settings-page-fields

WP Settings Page Fields

A package to render form fields in WordPress settings pages.

You might need a settings page with a form and its fields and you have to render the fields every time you create a custom plugin.

Maybe, you already have some snippets that generates the form fields for you, otherwise this package is for you.

Installation

You can install the package via composer:

Usage

Every supported form element extends the Roel\WP\Settings\Element class and must be instantiated with the same constructor:

These are the supported parameters:

WordPress

To register and render form elements in your settings page with this package, you can use:

Remember to add the array( $setting, 'print' ) as a callback to render the setting field. The $setting variable is an Roel\WP\Settings\Element instance.

Render

This is how you can create a form element instance and render the HTML:

Using the render method

Using the print method

Using echo directly to the instantiated class

Attributes

name attribute

Every form element includes a name attribute. This attribute will be used to assign the current element value to the $_POST variable, so you can manage that value like insert it into the database.

The name attribute value is generated by using the option_name and id. So, in the next example:

The name attribute would be:

Then, in PHP, you would access the value of that input like this:

HTML attributes

You can add HTML attributes to your form elements:

Group

Look at this example:

You see how the rmr_settings option name is repetitive? Now imagine to add more than 10 settings in the same page. For this kind of cases, you can use the Roel\WP\Settings\Group class.

The instance accepts two parameters:

The passed option name will be set to every passed form element.

After declaring the Group class with the required parameters, you can get the elements with elements() method, so you can loop and render them.

Settings

Check the available settings and more in the Wiki section.

Filters

Every form element has two filters to change the HTML output:

Check the filters for all form elements and more in the Wiki section.

Form Elements

These are the supported form elements so far:


All versions of wp-settings-page-fields with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package roelmagdaleno/wp-settings-page-fields contains the following files

Loading the files please wait ....