Changeset 2403247
- Timestamp:
- 10/20/2020 02:02:53 PM (5 years ago)
- Location:
- typerocket-ui
- Files:
-
- 3 added
- 21 edited
- 1 copied
-
assets/screenshot-1.png (modified) (previous)
-
assets/screenshot-2.png (added)
-
assets/screenshot-3.png (added)
-
assets/screenshot-4.png (added)
-
tags/5.0.3 (copied) (copied from typerocket-ui/trunk)
-
tags/5.0.3/readme.txt (modified) (2 diffs)
-
tags/5.0.3/typerocket-ui.php (modified) (1 diff)
-
tags/5.0.3/typerocket/composer.lock (modified) (2 diffs)
-
tags/5.0.3/typerocket/vendor/composer/InstalledVersions.php (modified) (3 diffs)
-
tags/5.0.3/typerocket/vendor/composer/installed.json (modified) (3 diffs)
-
tags/5.0.3/typerocket/vendor/composer/installed.php (modified) (3 diffs)
-
tags/5.0.3/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php (modified) (2 diffs)
-
tags/5.0.3/typerocket/vendor/typerocket/core/src/Extensions/views/typerocket-ui.php (modified) (2 diffs)
-
tags/5.0.3/typerocket/vendor/typerocket/core/src/Register/Page.php (modified) (1 diff)
-
tags/5.0.3/typerocket/vendor/typerocket/core/src/Register/Registrable.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/typerocket-ui.php (modified) (1 diff)
-
trunk/typerocket/composer.lock (modified) (2 diffs)
-
trunk/typerocket/vendor/composer/InstalledVersions.php (modified) (3 diffs)
-
trunk/typerocket/vendor/composer/installed.json (modified) (3 diffs)
-
trunk/typerocket/vendor/composer/installed.php (modified) (3 diffs)
-
trunk/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php (modified) (2 diffs)
-
trunk/typerocket/vendor/typerocket/core/src/Extensions/views/typerocket-ui.php (modified) (2 diffs)
-
trunk/typerocket/vendor/typerocket/core/src/Register/Page.php (modified) (1 diff)
-
trunk/typerocket/vendor/typerocket/core/src/Register/Registrable.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
typerocket-ui/tags/5.0.3/readme.txt
r2402883 r2403247 5 5 Requires PHP: 7.2.5 6 6 Tested up to: 5.5.1 7 Stable Tag: 5.0. 27 Stable Tag: 5.0.3 8 8 License: GPLv2 or later 9 9 … … 30 30 31 31 1. Registration UI. 32 2. Post type admin columns. 33 3. Remove post type slug prefix. 34 4. Override an existing post type. 32 35 33 36 == Changelog == 37 38 = 5.0.3 = 39 40 * Add help text. 34 41 35 42 = 5.0.2 = -
typerocket-ui/tags/5.0.3/typerocket-ui.php
r2402883 r2403247 4 4 Plugin URI: https://typerocket.com/ui/ 5 5 Description: This plugin provides a powerful user interface for creating post types, taxonomies, and meta boxes. 6 Version: 5.0. 26 Version: 5.0.3 7 7 Requires PHP: 7.2 8 8 Author: TypeRocket -
typerocket-ui/tags/5.0.3/typerocket/composer.lock
r2402883 r2403247 389 389 "type": "git", 390 390 "url": "https://github.com/TypeRocket/core.git", 391 "reference": " 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d"392 }, 393 "dist": { 394 "type": "zip", 395 "url": "https://api.github.com/repos/TypeRocket/core/zipball/ 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",396 "reference": " 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",391 "reference": "085b5f95bb41c63c599bc817e049998626ea341c" 392 }, 393 "dist": { 394 "type": "zip", 395 "url": "https://api.github.com/repos/TypeRocket/core/zipball/085b5f95bb41c63c599bc817e049998626ea341c", 396 "reference": "085b5f95bb41c63c599bc817e049998626ea341c", 397 397 "shasum": "" 398 398 }, … … 433 433 "docs": "https://typerocket.com/docs/v5/", 434 434 "issues": "https://github.com/TypeRocket/core/issues", 435 "source": "https://github.com/TypeRocket/core/tree/v5.0. 3"436 }, 437 "time": "2020-10-20T 01:01:39+00:00"435 "source": "https://github.com/TypeRocket/core/tree/v5.0.4" 436 }, 437 "time": "2020-10-20T13:40:56+00:00" 438 438 } 439 439 ], -
typerocket-ui/tags/5.0.3/typerocket/vendor/composer/InstalledVersions.php
r2402883 r2403247 20 20 array ( 21 21 ), 22 'reference' => '5 1991e51bc0db98ff58d4a7cab075ab758884e6b',22 'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db', 23 23 'name' => 'typerocket/typerocket', 24 24 ), … … 85 85 0 => '9999999-dev', 86 86 ), 87 'reference' => ' 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',87 'reference' => '085b5f95bb41c63c599bc817e049998626ea341c', 88 88 ), 89 89 'typerocket/typerocket' => … … 94 94 array ( 95 95 ), 96 'reference' => '5 1991e51bc0db98ff58d4a7cab075ab758884e6b',96 'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db', 97 97 ), 98 98 ), -
typerocket-ui/tags/5.0.3/typerocket/vendor/composer/installed.json
r2402883 r2403247 399 399 "type": "git", 400 400 "url": "https://github.com/TypeRocket/core.git", 401 "reference": " 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d"402 }, 403 "dist": { 404 "type": "zip", 405 "url": "https://api.github.com/repos/TypeRocket/core/zipball/ 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",406 "reference": " 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",401 "reference": "085b5f95bb41c63c599bc817e049998626ea341c" 402 }, 403 "dist": { 404 "type": "zip", 405 "url": "https://api.github.com/repos/TypeRocket/core/zipball/085b5f95bb41c63c599bc817e049998626ea341c", 406 "reference": "085b5f95bb41c63c599bc817e049998626ea341c", 407 407 "shasum": "" 408 408 }, … … 415 415 "phpunit/phpunit": "7.4.*" 416 416 }, 417 "time": "2020-10-20T 01:01:39+00:00",417 "time": "2020-10-20T13:40:56+00:00", 418 418 "default-branch": true, 419 419 "type": "library", … … 445 445 "docs": "https://typerocket.com/docs/v5/", 446 446 "issues": "https://github.com/TypeRocket/core/issues", 447 "source": "https://github.com/TypeRocket/core/tree/v5.0. 3"447 "source": "https://github.com/TypeRocket/core/tree/v5.0.4" 448 448 }, 449 449 "install-path": "../typerocket/core" -
typerocket-ui/tags/5.0.3/typerocket/vendor/composer/installed.php
r2402883 r2403247 7 7 array ( 8 8 ), 9 'reference' => '5 1991e51bc0db98ff58d4a7cab075ab758884e6b',9 'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db', 10 10 'name' => 'typerocket/typerocket', 11 11 ), … … 20 20 0 => '9999999-dev', 21 21 ), 22 'reference' => ' 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',22 'reference' => '085b5f95bb41c63c599bc817e049998626ea341c', 23 23 ), 24 24 'typerocket/typerocket' => … … 29 29 array ( 30 30 ), 31 'reference' => '5 1991e51bc0db98ff58d4a7cab075ab758884e6b',31 'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db', 32 32 ), 33 33 ), -
typerocket-ui/tags/5.0.3/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php
r2402883 r2403247 431 431 } 432 432 433 public function helpTabAdvanced() 434 { 435 ob_start() ?> 436 <p>You can use the ID of an existing post type or taxonomy to override its settings. Use the override feature with caution.</p> 437 <?php return ob_get_clean(); 438 } 439 433 440 /** 434 441 * Controller … … 439 446 public function show() 440 447 { 448 add_action('current_screen', function() { 449 $screen = get_current_screen(); 450 $screen->add_help_tab( array( 451 'id' => 'typerocket-ui-help', 452 'title' => 'Overrides', 453 'content' => __($this->helpTabAdvanced(), 'typerocket-ui') 454 )); 455 }); 456 441 457 $icons = Dashicons::new()->iconNames(); 442 458 $form = Helper::form()->useErrors()->useOld()->setDebugStatus(false)->setGroup(static::OPTION); -
typerocket-ui/tags/5.0.3/typerocket/vendor/typerocket/core/src/Extensions/views/typerocket-ui.php
r2402747 r2403247 10 10 11 11 $pt_tabs->tab(__('Basic', 'typerocket-ui'))->setFields( 12 $form->row( 13 $form->text('Singular', ['placeholder' => __('Singular label', 'typerocket-ui')])->markLabelRequired(), 14 $form->text('Plural', ['placeholder' => __('Plural label', 'typerocket-ui')]) 15 ), 16 $form->row( 17 $form->text('Post Type ID', ['placeholder' => __('Lowercase alphanumeric and underscores only', 'typerocket-ui')])->maxlength(20)->markLabelRequired(), 18 $form->text('Slug', ['placeholder' => __('Default value will be plural', 'typerocket-ui')]) 19 ), 12 $form->text('Singular', ['placeholder' => __('Singular label', 'typerocket-ui')]) 13 ->markLabelRequired() 14 ->setHelp(__('The singular name for the post type labels and settings.', 'typerocket-ui')), 15 $form->text('Plural', ['placeholder' => __('Plural label', 'typerocket-ui')]) 16 ->markLabelRequired() 17 ->setHelp(__('The plural name for the post type labels and settings.', 'typerocket-ui')), 18 $form->text('Post Type ID', ['placeholder' => __('Lowercase alphanumeric and underscores only', 'typerocket-ui')]) 19 ->maxlength(20) 20 ->markLabelRequired(), 21 $form->text('Slug', ['placeholder' => __('Default value will be plural', 'typerocket-ui')]) 22 ->setHelp(__('Customize the permastruct slug. Defaults to plural name.', 'typerocket-ui')), 20 23 $form->select('Icon')->setOptions($icons, 'flat')->searchable(), 21 24 $form->toggle('Gutenberg')->setText('Whether the post type should use Gutenberg.'), 22 $form->toggle('REST API')->setText('Whether to include the post type in the REST API.'), 25 $form->toggle('REST API')->setText('Whether to include the post type in the REST API.') 26 ->setHelp(__('When Gutenberg is enabled this setting will be enabled automatically.', 'typerocket-ui')), 23 27 $form->toggle('Hierarchical')->setText('Whether the post type is hierarchical (e.g. page).'), 24 28 $form->items('Taxonomies')->setHelp('The IDs of taxonomies you want applied to this post type.') … … 99 103 100 104 $tax_tabs->tab('Basic')->setFields( 101 $form->row( 102 $form->text('Singular', ['placeholder' => __('Singular label', 'typerocket-ui')])->markLabelRequired(), 103 $form->text('Plural', ['placeholder' => __('Plural label', 'typerocket-ui')]) 104 ), 105 $form->row( 106 $form->text('Taxonomy ID', ['placeholder' => __('Lowercase alphanumeric and underscores only', 'typerocket-ui')])->maxlength(32)->markLabelRequired(), 107 $form->text('Slug', ['placeholder' => __('Default value will be plural', 'typerocket-ui')]) 108 ), 105 $form->text('Singular', ['placeholder' => __('Singular label', 'typerocket-ui')]) 106 ->markLabelRequired() 107 ->setHelp(__('The singular name for the taxonomy labels and settings.', 'typerocket-ui')), 108 $form->text('Plural', ['placeholder' => __('Plural label', 'typerocket-ui')]) 109 ->markLabelRequired() 110 ->setHelp(__('The plural name for the taxonomy labels and settings.', 'typerocket-ui')), 111 $form->text('Taxonomy ID', ['placeholder' => __('Lowercase alphanumeric and underscores only', 'typerocket-ui')]) 112 ->maxlength(32) 113 ->markLabelRequired(), 114 $form->text('Slug', ['placeholder' => __('Default value will be plural', 'typerocket-ui')]) 115 ->setHelp(__('Customize the permastruct slug. Defaults to plural name.', 'typerocket-ui')), 109 116 $form->toggle('Hierarchical')->setText('Whether the post type is hierarchical (e.g. category).'), 110 117 $form->toggle('REST API')->setText('Whether to include the post type in the REST API.'), -
typerocket-ui/tags/5.0.3/typerocket/vendor/typerocket/core/src/Register/Page.php
r2402747 r2403247 746 746 } 747 747 } 748 749 /** 750 * @param string $singular 751 * @param string|array|null $plural 752 * @param array $settings 753 * @param null $resource 754 * @param null $handler 755 * 756 * @return static 757 * @throws \Exception 758 */ 759 public static function addResourcePages($singular, $plural = null, array $settings = [], $resource = null, $handler = null) 760 { 761 [$singular, $handle] = array_pad(explode('@', $singular), 2, null); 762 $handler = $handler ?? $handle; 763 764 if(is_array($plural)) { 765 $settings = $plural; 766 767 if(isset($settings['plural'])) { 768 $plural = $settings['plural']; 769 unset($settings['plural']); 770 } else { 771 $plural = null; 772 } 773 } 774 775 if ( ! $plural) { 776 $plural = \TypeRocket\Utility\Inflect::pluralize($singular); 777 } 778 779 if(!$handler) { 780 $handler = \TypeRocket\Utility\Helper::controllerClass($singular, false); 781 } 782 783 if( ! $resource) { 784 $resource = $singular; 785 } 786 787 $menu_id = 'add_resource_' . \TypeRocket\Utility\Sanitize::underscore($singular); 788 789 $add = \TypeRocket\Register\Page::add($resource, 'add', __('Add ' . $singular)) 790 ->setMenuTitle(__('Add New')) 791 ->adminBar($menu_id, $singular, 'new-content') 792 ->mapActions([ 793 'GET' => 'add', 794 'POST' => 'create', 795 ]); 796 797 $delete = \TypeRocket\Register\Page::add($resource, 'delete', 'Delete ' . $singular) 798 ->removeMenu() 799 ->mapActions([ 800 'GET' => 'delete', 801 'DELETE' => 'destroy', 802 ]); 803 804 $show = \TypeRocket\Register\Page::add($resource, 'show', $singular) 805 ->addNewButton() 806 ->removeMenu() 807 ->mapActions([ 808 'GET' => 'show' 809 ]); 810 811 $edit = \TypeRocket\Register\Page::add($resource, 'edit', __('Edit ' . $singular)) 812 ->addNewButton() 813 ->removeMenu() 814 ->mapActions([ 815 'GET' => 'edit', 816 'PUT' => 'update', 817 ]); 818 819 $index = \TypeRocket\Register\Page::add($resource, 'index', $plural, $settings) 820 ->apply($edit, $show, $delete, $add) 821 ->setSubMenuTitle(__('All ' . $plural)) 822 ->addNewButton(); 823 824 foreach ([$add, $edit, $delete, $show, $index] as $page) { 825 /** @var \TypeRocket\Register\Page $page */ 826 $page->setHandler($handler); 827 } 828 829 return $index; 830 } 748 831 } -
typerocket-ui/tags/5.0.3/typerocket/vendor/typerocket/core/src/Register/Registrable.php
r2402883 r2403247 319 319 return new static(...$args); 320 320 } 321 322 /**323 * @param string $singular324 * @param string|array|null $plural325 * @param array $settings326 * @param null $resource327 * @param null $handler328 *329 * @return static330 * @throws \Exception331 */332 public static function addResourcePages($singular, $plural = null, array $settings = [], $resource = null, $handler = null)333 {334 [$singular, $handle] = array_pad(explode('@', $singular), 2, null);335 $handler = $handler ?? $handle;336 337 if(is_array($plural)) {338 $settings = $plural;339 340 if(isset($settings['plural'])) {341 $plural = $settings['plural'];342 unset($settings['plural']);343 } else {344 $plural = null;345 }346 }347 348 if ( ! $plural) {349 $plural = \TypeRocket\Utility\Inflect::pluralize($singular);350 }351 352 if(!$handler) {353 $handler = \TypeRocket\Utility\Helper::controllerClass($singular, false);354 }355 356 if( ! $resource) {357 $resource = $singular;358 }359 360 $menu_id = 'add_resource_' . \TypeRocket\Utility\Sanitize::underscore($singular);361 362 $add = \TypeRocket\Register\Page::add($resource, 'add', __('Add ' . $singular))363 ->setMenuTitle(__('Add New'))364 ->adminBar($menu_id, $singular, 'new-content')365 ->mapActions([366 'GET' => 'add',367 'POST' => 'create',368 ]);369 370 $delete = \TypeRocket\Register\Page::add($resource, 'delete', 'Delete ' . $singular)371 ->removeMenu()372 ->mapActions([373 'GET' => 'delete',374 'DELETE' => 'destroy',375 ]);376 377 $show = \TypeRocket\Register\Page::add($resource, 'show', $singular)378 ->addNewButton()379 ->removeMenu()380 ->mapActions([381 'GET' => 'show'382 ]);383 384 $edit = \TypeRocket\Register\Page::add($resource, 'edit', __('Edit ' . $singular))385 ->addNewButton()386 ->removeMenu()387 ->mapActions([388 'GET' => 'edit',389 'PUT' => 'update',390 ]);391 392 $index = \TypeRocket\Register\Page::add($resource, 'index', $plural, $settings)393 ->apply($edit, $show, $delete, $add)394 ->setSubMenuTitle(__('All ' . $plural))395 ->addNewButton();396 397 foreach ([$add, $edit, $delete, $show, $index] as $page) {398 /** @var \TypeRocket\Register\Page $page */399 $page->setHandler($handler);400 }401 402 return $index;403 }404 321 } -
typerocket-ui/trunk/readme.txt
r2402883 r2403247 5 5 Requires PHP: 7.2.5 6 6 Tested up to: 5.5.1 7 Stable Tag: 5.0. 27 Stable Tag: 5.0.3 8 8 License: GPLv2 or later 9 9 … … 30 30 31 31 1. Registration UI. 32 2. Post type admin columns. 33 3. Remove post type slug prefix. 34 4. Override an existing post type. 32 35 33 36 == Changelog == 37 38 = 5.0.3 = 39 40 * Add help text. 34 41 35 42 = 5.0.2 = -
typerocket-ui/trunk/typerocket-ui.php
r2402883 r2403247 4 4 Plugin URI: https://typerocket.com/ui/ 5 5 Description: This plugin provides a powerful user interface for creating post types, taxonomies, and meta boxes. 6 Version: 5.0. 26 Version: 5.0.3 7 7 Requires PHP: 7.2 8 8 Author: TypeRocket -
typerocket-ui/trunk/typerocket/composer.lock
r2402883 r2403247 389 389 "type": "git", 390 390 "url": "https://github.com/TypeRocket/core.git", 391 "reference": " 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d"392 }, 393 "dist": { 394 "type": "zip", 395 "url": "https://api.github.com/repos/TypeRocket/core/zipball/ 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",396 "reference": " 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",391 "reference": "085b5f95bb41c63c599bc817e049998626ea341c" 392 }, 393 "dist": { 394 "type": "zip", 395 "url": "https://api.github.com/repos/TypeRocket/core/zipball/085b5f95bb41c63c599bc817e049998626ea341c", 396 "reference": "085b5f95bb41c63c599bc817e049998626ea341c", 397 397 "shasum": "" 398 398 }, … … 433 433 "docs": "https://typerocket.com/docs/v5/", 434 434 "issues": "https://github.com/TypeRocket/core/issues", 435 "source": "https://github.com/TypeRocket/core/tree/v5.0. 3"436 }, 437 "time": "2020-10-20T 01:01:39+00:00"435 "source": "https://github.com/TypeRocket/core/tree/v5.0.4" 436 }, 437 "time": "2020-10-20T13:40:56+00:00" 438 438 } 439 439 ], -
typerocket-ui/trunk/typerocket/vendor/composer/InstalledVersions.php
r2402883 r2403247 20 20 array ( 21 21 ), 22 'reference' => '5 1991e51bc0db98ff58d4a7cab075ab758884e6b',22 'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db', 23 23 'name' => 'typerocket/typerocket', 24 24 ), … … 85 85 0 => '9999999-dev', 86 86 ), 87 'reference' => ' 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',87 'reference' => '085b5f95bb41c63c599bc817e049998626ea341c', 88 88 ), 89 89 'typerocket/typerocket' => … … 94 94 array ( 95 95 ), 96 'reference' => '5 1991e51bc0db98ff58d4a7cab075ab758884e6b',96 'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db', 97 97 ), 98 98 ), -
typerocket-ui/trunk/typerocket/vendor/composer/installed.json
r2402883 r2403247 399 399 "type": "git", 400 400 "url": "https://github.com/TypeRocket/core.git", 401 "reference": " 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d"402 }, 403 "dist": { 404 "type": "zip", 405 "url": "https://api.github.com/repos/TypeRocket/core/zipball/ 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",406 "reference": " 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d",401 "reference": "085b5f95bb41c63c599bc817e049998626ea341c" 402 }, 403 "dist": { 404 "type": "zip", 405 "url": "https://api.github.com/repos/TypeRocket/core/zipball/085b5f95bb41c63c599bc817e049998626ea341c", 406 "reference": "085b5f95bb41c63c599bc817e049998626ea341c", 407 407 "shasum": "" 408 408 }, … … 415 415 "phpunit/phpunit": "7.4.*" 416 416 }, 417 "time": "2020-10-20T 01:01:39+00:00",417 "time": "2020-10-20T13:40:56+00:00", 418 418 "default-branch": true, 419 419 "type": "library", … … 445 445 "docs": "https://typerocket.com/docs/v5/", 446 446 "issues": "https://github.com/TypeRocket/core/issues", 447 "source": "https://github.com/TypeRocket/core/tree/v5.0. 3"447 "source": "https://github.com/TypeRocket/core/tree/v5.0.4" 448 448 }, 449 449 "install-path": "../typerocket/core" -
typerocket-ui/trunk/typerocket/vendor/composer/installed.php
r2402883 r2403247 7 7 array ( 8 8 ), 9 'reference' => '5 1991e51bc0db98ff58d4a7cab075ab758884e6b',9 'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db', 10 10 'name' => 'typerocket/typerocket', 11 11 ), … … 20 20 0 => '9999999-dev', 21 21 ), 22 'reference' => ' 88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',22 'reference' => '085b5f95bb41c63c599bc817e049998626ea341c', 23 23 ), 24 24 'typerocket/typerocket' => … … 29 29 array ( 30 30 ), 31 'reference' => '5 1991e51bc0db98ff58d4a7cab075ab758884e6b',31 'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db', 32 32 ), 33 33 ), -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php
r2402883 r2403247 431 431 } 432 432 433 public function helpTabAdvanced() 434 { 435 ob_start() ?> 436 <p>You can use the ID of an existing post type or taxonomy to override its settings. Use the override feature with caution.</p> 437 <?php return ob_get_clean(); 438 } 439 433 440 /** 434 441 * Controller … … 439 446 public function show() 440 447 { 448 add_action('current_screen', function() { 449 $screen = get_current_screen(); 450 $screen->add_help_tab( array( 451 'id' => 'typerocket-ui-help', 452 'title' => 'Overrides', 453 'content' => __($this->helpTabAdvanced(), 'typerocket-ui') 454 )); 455 }); 456 441 457 $icons = Dashicons::new()->iconNames(); 442 458 $form = Helper::form()->useErrors()->useOld()->setDebugStatus(false)->setGroup(static::OPTION); -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Extensions/views/typerocket-ui.php
r2402747 r2403247 10 10 11 11 $pt_tabs->tab(__('Basic', 'typerocket-ui'))->setFields( 12 $form->row( 13 $form->text('Singular', ['placeholder' => __('Singular label', 'typerocket-ui')])->markLabelRequired(), 14 $form->text('Plural', ['placeholder' => __('Plural label', 'typerocket-ui')]) 15 ), 16 $form->row( 17 $form->text('Post Type ID', ['placeholder' => __('Lowercase alphanumeric and underscores only', 'typerocket-ui')])->maxlength(20)->markLabelRequired(), 18 $form->text('Slug', ['placeholder' => __('Default value will be plural', 'typerocket-ui')]) 19 ), 12 $form->text('Singular', ['placeholder' => __('Singular label', 'typerocket-ui')]) 13 ->markLabelRequired() 14 ->setHelp(__('The singular name for the post type labels and settings.', 'typerocket-ui')), 15 $form->text('Plural', ['placeholder' => __('Plural label', 'typerocket-ui')]) 16 ->markLabelRequired() 17 ->setHelp(__('The plural name for the post type labels and settings.', 'typerocket-ui')), 18 $form->text('Post Type ID', ['placeholder' => __('Lowercase alphanumeric and underscores only', 'typerocket-ui')]) 19 ->maxlength(20) 20 ->markLabelRequired(), 21 $form->text('Slug', ['placeholder' => __('Default value will be plural', 'typerocket-ui')]) 22 ->setHelp(__('Customize the permastruct slug. Defaults to plural name.', 'typerocket-ui')), 20 23 $form->select('Icon')->setOptions($icons, 'flat')->searchable(), 21 24 $form->toggle('Gutenberg')->setText('Whether the post type should use Gutenberg.'), 22 $form->toggle('REST API')->setText('Whether to include the post type in the REST API.'), 25 $form->toggle('REST API')->setText('Whether to include the post type in the REST API.') 26 ->setHelp(__('When Gutenberg is enabled this setting will be enabled automatically.', 'typerocket-ui')), 23 27 $form->toggle('Hierarchical')->setText('Whether the post type is hierarchical (e.g. page).'), 24 28 $form->items('Taxonomies')->setHelp('The IDs of taxonomies you want applied to this post type.') … … 99 103 100 104 $tax_tabs->tab('Basic')->setFields( 101 $form->row( 102 $form->text('Singular', ['placeholder' => __('Singular label', 'typerocket-ui')])->markLabelRequired(), 103 $form->text('Plural', ['placeholder' => __('Plural label', 'typerocket-ui')]) 104 ), 105 $form->row( 106 $form->text('Taxonomy ID', ['placeholder' => __('Lowercase alphanumeric and underscores only', 'typerocket-ui')])->maxlength(32)->markLabelRequired(), 107 $form->text('Slug', ['placeholder' => __('Default value will be plural', 'typerocket-ui')]) 108 ), 105 $form->text('Singular', ['placeholder' => __('Singular label', 'typerocket-ui')]) 106 ->markLabelRequired() 107 ->setHelp(__('The singular name for the taxonomy labels and settings.', 'typerocket-ui')), 108 $form->text('Plural', ['placeholder' => __('Plural label', 'typerocket-ui')]) 109 ->markLabelRequired() 110 ->setHelp(__('The plural name for the taxonomy labels and settings.', 'typerocket-ui')), 111 $form->text('Taxonomy ID', ['placeholder' => __('Lowercase alphanumeric and underscores only', 'typerocket-ui')]) 112 ->maxlength(32) 113 ->markLabelRequired(), 114 $form->text('Slug', ['placeholder' => __('Default value will be plural', 'typerocket-ui')]) 115 ->setHelp(__('Customize the permastruct slug. Defaults to plural name.', 'typerocket-ui')), 109 116 $form->toggle('Hierarchical')->setText('Whether the post type is hierarchical (e.g. category).'), 110 117 $form->toggle('REST API')->setText('Whether to include the post type in the REST API.'), -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Register/Page.php
r2402747 r2403247 746 746 } 747 747 } 748 749 /** 750 * @param string $singular 751 * @param string|array|null $plural 752 * @param array $settings 753 * @param null $resource 754 * @param null $handler 755 * 756 * @return static 757 * @throws \Exception 758 */ 759 public static function addResourcePages($singular, $plural = null, array $settings = [], $resource = null, $handler = null) 760 { 761 [$singular, $handle] = array_pad(explode('@', $singular), 2, null); 762 $handler = $handler ?? $handle; 763 764 if(is_array($plural)) { 765 $settings = $plural; 766 767 if(isset($settings['plural'])) { 768 $plural = $settings['plural']; 769 unset($settings['plural']); 770 } else { 771 $plural = null; 772 } 773 } 774 775 if ( ! $plural) { 776 $plural = \TypeRocket\Utility\Inflect::pluralize($singular); 777 } 778 779 if(!$handler) { 780 $handler = \TypeRocket\Utility\Helper::controllerClass($singular, false); 781 } 782 783 if( ! $resource) { 784 $resource = $singular; 785 } 786 787 $menu_id = 'add_resource_' . \TypeRocket\Utility\Sanitize::underscore($singular); 788 789 $add = \TypeRocket\Register\Page::add($resource, 'add', __('Add ' . $singular)) 790 ->setMenuTitle(__('Add New')) 791 ->adminBar($menu_id, $singular, 'new-content') 792 ->mapActions([ 793 'GET' => 'add', 794 'POST' => 'create', 795 ]); 796 797 $delete = \TypeRocket\Register\Page::add($resource, 'delete', 'Delete ' . $singular) 798 ->removeMenu() 799 ->mapActions([ 800 'GET' => 'delete', 801 'DELETE' => 'destroy', 802 ]); 803 804 $show = \TypeRocket\Register\Page::add($resource, 'show', $singular) 805 ->addNewButton() 806 ->removeMenu() 807 ->mapActions([ 808 'GET' => 'show' 809 ]); 810 811 $edit = \TypeRocket\Register\Page::add($resource, 'edit', __('Edit ' . $singular)) 812 ->addNewButton() 813 ->removeMenu() 814 ->mapActions([ 815 'GET' => 'edit', 816 'PUT' => 'update', 817 ]); 818 819 $index = \TypeRocket\Register\Page::add($resource, 'index', $plural, $settings) 820 ->apply($edit, $show, $delete, $add) 821 ->setSubMenuTitle(__('All ' . $plural)) 822 ->addNewButton(); 823 824 foreach ([$add, $edit, $delete, $show, $index] as $page) { 825 /** @var \TypeRocket\Register\Page $page */ 826 $page->setHandler($handler); 827 } 828 829 return $index; 830 } 748 831 } -
typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Register/Registrable.php
r2402883 r2403247 319 319 return new static(...$args); 320 320 } 321 322 /**323 * @param string $singular324 * @param string|array|null $plural325 * @param array $settings326 * @param null $resource327 * @param null $handler328 *329 * @return static330 * @throws \Exception331 */332 public static function addResourcePages($singular, $plural = null, array $settings = [], $resource = null, $handler = null)333 {334 [$singular, $handle] = array_pad(explode('@', $singular), 2, null);335 $handler = $handler ?? $handle;336 337 if(is_array($plural)) {338 $settings = $plural;339 340 if(isset($settings['plural'])) {341 $plural = $settings['plural'];342 unset($settings['plural']);343 } else {344 $plural = null;345 }346 }347 348 if ( ! $plural) {349 $plural = \TypeRocket\Utility\Inflect::pluralize($singular);350 }351 352 if(!$handler) {353 $handler = \TypeRocket\Utility\Helper::controllerClass($singular, false);354 }355 356 if( ! $resource) {357 $resource = $singular;358 }359 360 $menu_id = 'add_resource_' . \TypeRocket\Utility\Sanitize::underscore($singular);361 362 $add = \TypeRocket\Register\Page::add($resource, 'add', __('Add ' . $singular))363 ->setMenuTitle(__('Add New'))364 ->adminBar($menu_id, $singular, 'new-content')365 ->mapActions([366 'GET' => 'add',367 'POST' => 'create',368 ]);369 370 $delete = \TypeRocket\Register\Page::add($resource, 'delete', 'Delete ' . $singular)371 ->removeMenu()372 ->mapActions([373 'GET' => 'delete',374 'DELETE' => 'destroy',375 ]);376 377 $show = \TypeRocket\Register\Page::add($resource, 'show', $singular)378 ->addNewButton()379 ->removeMenu()380 ->mapActions([381 'GET' => 'show'382 ]);383 384 $edit = \TypeRocket\Register\Page::add($resource, 'edit', __('Edit ' . $singular))385 ->addNewButton()386 ->removeMenu()387 ->mapActions([388 'GET' => 'edit',389 'PUT' => 'update',390 ]);391 392 $index = \TypeRocket\Register\Page::add($resource, 'index', $plural, $settings)393 ->apply($edit, $show, $delete, $add)394 ->setSubMenuTitle(__('All ' . $plural))395 ->addNewButton();396 397 foreach ([$add, $edit, $delete, $show, $index] as $page) {398 /** @var \TypeRocket\Register\Page $page */399 $page->setHandler($handler);400 }401 402 return $index;403 }404 321 }
Note: See TracChangeset
for help on using the changeset viewer.