Skip to content
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

Enable customised name and keyword for shortcodes instead of class name #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michalkleiner
Copy link

Issue #10

This change adds an option to assign more descriptive name than the classname (appears in the modal dropdown) as well as select a keyword placeholder for the wysiwyg editor.

@jelicanin
Copy link

+1

@sheadawson
Copy link
Owner

Thanks for this! I wonder if it would be preferable to stick with the SS convention of private static $singular_name and $plural_name instead of getShortcodeNiceName? This can be accessed on any DataObject through the existing singular_name method, which falls back to a nicely formatted version of the data object's class name. Subclasses of ViewableData that are shortcodable would need to implement these directly.

getShortcodeKeyword method also seems like it would be more suited to being a static config. Thoughts?

@wernerkrauss
Copy link
Contributor

Well, we could use $singular_name as a default and still have the possibility to overwrite it if with a custom method if something different is needed?

@sheadawson
Copy link
Owner

@wernerkrauss yeap sounds good, how about first the module checks for the object's $shortcode_name config value, with a fallback to singular_name() method

shortcode_name and shortcode_keyword both seem more suited to being static config values than methods but please let me know if you think they should be methods for any reason I might be missing :)

@wernerkrauss
Copy link
Contributor

Well, DataObject has a singular_name() method which does a fallback (basically for getting the singularName out of the class name if it's not defined and to get translations).

Do we need translations? Maybe for keyword, but not for the shortcode name, as this must fit to the classname we use for getting the shortcode rendered. Thinking about it, translating the keyword sounds very sexy to me.

I'd like methods we plug to DataObject via an Extension class, this is most flexible. Then the shortcode can rely that the method exists on the DataObject and we could overwrite it if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants