-
-
Notifications
You must be signed in to change notification settings - Fork 31
Improve support for CPT and CTT #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ctly in stubs - Better code for CPT, so now generates automatically the default name, plural, slug based on name - Added a function to avoid create a post_type name larger than 20 characters (as described here: https://developer.wordpress.org/reference/functions/register_post_type/ ) - Added support to set showInRest and showUI directly supports in CPT - Added a default icon for the stub of CPT, so we avoid the empty space
- Added support to pre-fill the data on CTT - Allow multiple Post Type support to CTT - Added support to set showui by default on CTT
@bredecl hey, thank you for the PR 🙏 - where is your previous PR about the database? |
@gfazioli I deleted it, it wasn't working as I expected, but I will work it again in it. |
- explanation of CTT fix
WIP: Add support for WPBONES_TEXTDOMAIN - Added a Menu Relations to self generated menus from CTT - Added support to make use of WPBONES_TEXTDOMAIN on Admin Menu Provider Important, this could lead to a break on your code, you *need* to add at least ``` defined("WPBONES_TEXTDOMAIN","your_text_domain"); ``` in `config.php` or update your code based on wpbones/WPKirk#32
@gfazioli hi! I look forward to your feedback |
fix closes the askYesNo method
Yes,
|
hi @gfazioli |
What do you mean exactly? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@balazsnasz maybe you already know, but the namespace is not correct
* @param string|null $default The default value | ||
*/ | ||
protected function ask(string $str, ?string $default = ''): string | ||
protected function ask(string $str, ?string $default = '',?string $example = ''): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the new optional $example param in the function docs
@param string|null $example
return $line ?: $default; | ||
} | ||
/** | ||
* Get input from console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe the doc need updating
$this->line(' Created plugin/Console/Kernel.php'); | ||
} | ||
} | ||
protected function simplePluralize($word) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
miss doc
"Remember to add \\{$namespace}\CustomPostTypes\\{$className} in the config/plugin.php array in the 'custom_post_types' key." | ||
); | ||
} | ||
private function stringToArray($content){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
miss doc
} | ||
return $itemsSupport; | ||
} | ||
private function slugify($namespace,$name,$remove=0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
miss doc
"Remember to add \\{$namespace}\CustomPostTypes\\{$className} in the config/plugin.php array in the 'custom_post_types' key." | ||
); | ||
} | ||
private function stringToArray($content){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think to use this version
private function stringToArray($content) {
// Split the string by commas and trim whitespace from each item
$items = array_map('trim', explode(",", $content));
// Filter out any empty items
return array_filter($items, fn($item) => !empty($item));
}
} | ||
return $itemsSupport; | ||
} | ||
private function slugify($namespace,$name,$remove=0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is the purpose of this function?
@gfazioli are you sure you wanted to tag me? @bredecl was working on this issue and I have no clue about this issue |
yep, sorry, I wanted tag @bredecl 🙏 |
Hi
I made some improvements for the bones cli and content