evanshunt/carbon-fields-smartlink

Carbon Fields extension, that adds a SmartLink field type.

Installs: 1 620

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 5

Forks: 0

Open Issues: 0

Language:JavaScript

1.0.5 2019-04-01 19:09 UTC

This package is auto-updated.

Last update: 2020-12-30 02:49:04 UTC


README

This field allows you to select between internal and external links, choosing from a dropdown of Posts and Archives for internal links or manually entering a URL for external.

This repository is based on htmlburger/carbon-fields-template.

Installation

composer require evanshunt/carbon-fields-smartlink

Usage

use Carbon_Fields\Field\Field;

...

Field::make('smartlink', 'your_field_name', 'Your Field Name');

TODO

  1. Build in logic to neatly upgrade from a text URL field, redefining such as an external link.
  2. Add support for taxonomies, etc.

Building assets

  1. Edit webpack.config.js and make sure const root points to the directory where Carbon Fields are installed (e.g. const root = path.resolve(__dirname, '../vendor/includes/htmlburger/carbon-fields'); )
  2. Execute npm install in the root directory to install all build process requirements.
  3. Execute npm run build to build the final minimized assets

Optional

Execute npm run dev to continuously build assets during development. Note that you should add define( 'SCRIPT_DEBUG', true ); to your wp-config.php file in order to load the files generated by the dev build process.