Plugin Directory

Changeset 2403247


Ignore:
Timestamp:
10/20/2020 02:02:53 PM (5 years ago)
Author:
kevindees
Message:

Update to version 5.0.3 from GitHub

Location:
typerocket-ui
Files:
3 added
21 edited
1 copied

Legend:

Unmodified
Added
Removed
  • typerocket-ui/tags/5.0.3/readme.txt

    r2402883 r2403247  
    55Requires PHP: 7.2.5
    66Tested up to: 5.5.1
    7 Stable Tag: 5.0.2
     7Stable Tag: 5.0.3
    88License: GPLv2 or later
    99
     
    3030
    31311. Registration UI.
     322. Post type admin columns.
     333. Remove post type slug prefix.
     344. Override an existing post type.
    3235
    3336== Changelog ==
     37
     38= 5.0.3 =
     39
     40* Add help text.
    3441
    3542= 5.0.2 =
  • typerocket-ui/tags/5.0.3/typerocket-ui.php

    r2402883 r2403247  
    44Plugin URI: https://typerocket.com/ui/
    55Description: This plugin provides a powerful user interface for creating post types, taxonomies, and meta boxes.
    6 Version: 5.0.2
     6Version: 5.0.3
    77Requires PHP: 7.2
    88Author: TypeRocket
  • typerocket-ui/tags/5.0.3/typerocket/composer.lock

    r2402883 r2403247  
    389389                "type": "git",
    390390                "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",
    397397                "shasum": ""
    398398            },
     
    433433                "docs": "https://typerocket.com/docs/v5/",
    434434                "issues": "https://github.com/TypeRocket/core/issues",
    435                 "source": "https://github.com/TypeRocket/core/tree/v5.0.3"
    436             },
    437             "time": "2020-10-20T01: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"
    438438        }
    439439    ],
  • typerocket-ui/tags/5.0.3/typerocket/vendor/composer/InstalledVersions.php

    r2402883 r2403247  
    2020    array (
    2121    ),
    22     'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
     22    'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db',
    2323    'name' => 'typerocket/typerocket',
    2424  ),
     
    8585        0 => '9999999-dev',
    8686      ),
    87       'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',
     87      'reference' => '085b5f95bb41c63c599bc817e049998626ea341c',
    8888    ),
    8989    'typerocket/typerocket' =>
     
    9494      array (
    9595      ),
    96       'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
     96      'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db',
    9797    ),
    9898  ),
  • typerocket-ui/tags/5.0.3/typerocket/vendor/composer/installed.json

    r2402883 r2403247  
    399399                "type": "git",
    400400                "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",
    407407                "shasum": ""
    408408            },
     
    415415                "phpunit/phpunit": "7.4.*"
    416416            },
    417             "time": "2020-10-20T01:01:39+00:00",
     417            "time": "2020-10-20T13:40:56+00:00",
    418418            "default-branch": true,
    419419            "type": "library",
     
    445445                "docs": "https://typerocket.com/docs/v5/",
    446446                "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"
    448448            },
    449449            "install-path": "../typerocket/core"
  • typerocket-ui/tags/5.0.3/typerocket/vendor/composer/installed.php

    r2402883 r2403247  
    77    array (
    88    ),
    9     'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
     9    'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db',
    1010    'name' => 'typerocket/typerocket',
    1111  ),
     
    2020        0 => '9999999-dev',
    2121      ),
    22       'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',
     22      'reference' => '085b5f95bb41c63c599bc817e049998626ea341c',
    2323    ),
    2424    'typerocket/typerocket' =>
     
    2929      array (
    3030      ),
    31       'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
     31      'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db',
    3232    ),
    3333  ),
  • typerocket-ui/tags/5.0.3/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php

    r2402883 r2403247  
    431431    }
    432432
     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
    433440    /**
    434441     * Controller
     
    439446    public function show()
    440447    {
     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
    441457        $icons = Dashicons::new()->iconNames();
    442458        $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  
    1010
    1111$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')),
    2023    $form->select('Icon')->setOptions($icons, 'flat')->searchable(),
    2124    $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')),
    2327    $form->toggle('Hierarchical')->setText('Whether the post type is hierarchical (e.g. page).'),
    2428    $form->items('Taxonomies')->setHelp('The IDs of taxonomies you want applied to this post type.')
     
    99103
    100104$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')),
    109116    $form->toggle('Hierarchical')->setText('Whether the post type is hierarchical (e.g. category).'),
    110117    $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  
    746746        }
    747747    }
     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    }
    748831}
  • typerocket-ui/tags/5.0.3/typerocket/vendor/typerocket/core/src/Register/Registrable.php

    r2402883 r2403247  
    319319        return new static(...$args);
    320320    }
    321 
    322     /**
    323      * @param string $singular
    324      * @param string|array|null $plural
    325      * @param array $settings
    326      * @param null $resource
    327      * @param null $handler
    328      *
    329      * @return static
    330      * @throws \Exception
    331      */
    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     }
    404321}
  • typerocket-ui/trunk/readme.txt

    r2402883 r2403247  
    55Requires PHP: 7.2.5
    66Tested up to: 5.5.1
    7 Stable Tag: 5.0.2
     7Stable Tag: 5.0.3
    88License: GPLv2 or later
    99
     
    3030
    31311. Registration UI.
     322. Post type admin columns.
     333. Remove post type slug prefix.
     344. Override an existing post type.
    3235
    3336== Changelog ==
     37
     38= 5.0.3 =
     39
     40* Add help text.
    3441
    3542= 5.0.2 =
  • typerocket-ui/trunk/typerocket-ui.php

    r2402883 r2403247  
    44Plugin URI: https://typerocket.com/ui/
    55Description: This plugin provides a powerful user interface for creating post types, taxonomies, and meta boxes.
    6 Version: 5.0.2
     6Version: 5.0.3
    77Requires PHP: 7.2
    88Author: TypeRocket
  • typerocket-ui/trunk/typerocket/composer.lock

    r2402883 r2403247  
    389389                "type": "git",
    390390                "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",
    397397                "shasum": ""
    398398            },
     
    433433                "docs": "https://typerocket.com/docs/v5/",
    434434                "issues": "https://github.com/TypeRocket/core/issues",
    435                 "source": "https://github.com/TypeRocket/core/tree/v5.0.3"
    436             },
    437             "time": "2020-10-20T01: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"
    438438        }
    439439    ],
  • typerocket-ui/trunk/typerocket/vendor/composer/InstalledVersions.php

    r2402883 r2403247  
    2020    array (
    2121    ),
    22     'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
     22    'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db',
    2323    'name' => 'typerocket/typerocket',
    2424  ),
     
    8585        0 => '9999999-dev',
    8686      ),
    87       'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',
     87      'reference' => '085b5f95bb41c63c599bc817e049998626ea341c',
    8888    ),
    8989    'typerocket/typerocket' =>
     
    9494      array (
    9595      ),
    96       'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
     96      'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db',
    9797    ),
    9898  ),
  • typerocket-ui/trunk/typerocket/vendor/composer/installed.json

    r2402883 r2403247  
    399399                "type": "git",
    400400                "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",
    407407                "shasum": ""
    408408            },
     
    415415                "phpunit/phpunit": "7.4.*"
    416416            },
    417             "time": "2020-10-20T01:01:39+00:00",
     417            "time": "2020-10-20T13:40:56+00:00",
    418418            "default-branch": true,
    419419            "type": "library",
     
    445445                "docs": "https://typerocket.com/docs/v5/",
    446446                "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"
    448448            },
    449449            "install-path": "../typerocket/core"
  • typerocket-ui/trunk/typerocket/vendor/composer/installed.php

    r2402883 r2403247  
    77    array (
    88    ),
    9     'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
     9    'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db',
    1010    'name' => 'typerocket/typerocket',
    1111  ),
     
    2020        0 => '9999999-dev',
    2121      ),
    22       'reference' => '88d2cb62d8e892a0c1f8d18cd2a44ee35215605d',
     22      'reference' => '085b5f95bb41c63c599bc817e049998626ea341c',
    2323    ),
    2424    'typerocket/typerocket' =>
     
    2929      array (
    3030      ),
    31       'reference' => '51991e51bc0db98ff58d4a7cab075ab758884e6b',
     31      'reference' => '5e1902057d2c0f2186aa77450d718faa6397b2db',
    3232    ),
    3333  ),
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Extensions/TypeRocketUI.php

    r2402883 r2403247  
    431431    }
    432432
     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
    433440    /**
    434441     * Controller
     
    439446    public function show()
    440447    {
     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
    441457        $icons = Dashicons::new()->iconNames();
    442458        $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  
    1010
    1111$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')),
    2023    $form->select('Icon')->setOptions($icons, 'flat')->searchable(),
    2124    $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')),
    2327    $form->toggle('Hierarchical')->setText('Whether the post type is hierarchical (e.g. page).'),
    2428    $form->items('Taxonomies')->setHelp('The IDs of taxonomies you want applied to this post type.')
     
    99103
    100104$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')),
    109116    $form->toggle('Hierarchical')->setText('Whether the post type is hierarchical (e.g. category).'),
    110117    $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  
    746746        }
    747747    }
     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    }
    748831}
  • typerocket-ui/trunk/typerocket/vendor/typerocket/core/src/Register/Registrable.php

    r2402883 r2403247  
    319319        return new static(...$args);
    320320    }
    321 
    322     /**
    323      * @param string $singular
    324      * @param string|array|null $plural
    325      * @param array $settings
    326      * @param null $resource
    327      * @param null $handler
    328      *
    329      * @return static
    330      * @throws \Exception
    331      */
    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     }
    404321}
Note: See TracChangeset for help on using the changeset viewer.