In SilverStripe 3, How can I add multilevel CMSMenu items. I can add one level CMSMenu item by declaring in ModelAdmin class using
static $menu_title
Is there any way to add custom multilevel CMSMenu items ? One example implemented by defualt is "Files" (image attached for kind consideration).
Not yet!
You can add them individually as menu items and use css/javascript to arrange them as submenus under the parent...
Related
Is it possible to have a Model Admin type setup, where there is a tab on the left menu e.g Staff Members, and on the right instead of just displaying a grid and managing a model, I want to have fields that sit above the grid and be able to save data to them...
Essentially working exactly the same as how you would do it on a page, but instead in its own tab on the sidebar etc?
Picture of what I am trying to achieve (Photoshopped)
Is this possible?
Yes you can. You'll have to create your own subclass of LeftAndMain and implement your Form by overriding getEditForm.
Say you named your new LeftAndMain subclass StaffAdmin, then you can add it to the CMS menu by adding this to your _config.php file:
CMSMenu::add_menu_item('StaffAdmin', 'Staff Admin', 'staffadmin', 'StaffAdmin');
I am new to Drupal and I want to make a Metro-style set of shortcuts to webapps in my Drupal 7 installation.
I want to make it dynamic, so anyone user with permissions can edit them in Drupal.
From what I see, I need the following fields:
Icon URL / Icon Image
Title
Body
Color
URL
So, should I create custom type "My Custom Menu" and use Views module to retrieve them and a views-MYVIEW.tpl.php file? Or can this be done in other simpler way.
Thanks a lot.
I'd use a Node and views to achieve this. I don't think you need a tpl for this, I think some css will do just fine.
Just create your Node with those fields
Create your view as an unordered list
I would make the order Color (hidden), url (hidden), Global: custom text, Image, title, body, Global: Custom text
Set your css on the views row to float left
set your css on the views row to 50%, you might need some adjusting here to allow for the padding
Then just adjust your css to get the other elements in place
For the first global custom text
remove the label
Go to the style accordion and set the Customize field HTML to None
Go to the style accordion and set the Customize field and label wrapper HTML to None
Set the text to something like
<div class="[color_field]"><a href="[url_field]">
For the second global custom text
remove the label
Go to the style accordion and set the Customize field HTML to None
Go to the style accordion and set the Customize field and label wrapper HTML to None
Set the text to something like
</a></div>
The Global Custom text fields will create a wrapper around all of the fields within the views row for your color and link. Look at your Replacement Patterns accordion for the names of your fields in the view, I've used color_field and url_field as placeholders above
I think the best way is to use Views and then style using css. In your view format use either GRID or MASONRY API to achieve the metro layout and show FIELDS. Use the Fields to fetch your desired content from the published content.
You can use special content type and view to get nodes in that type as other people suggested. Also you can use views_get_view_result()
https://api.drupal.org/api/views/views.module/function/views_get_view_result/7
To just get array of nodes and loop trough them on your own, without using any template files. This way you can use totally your HTML and just print out values from results array this function returned.
But, you can do it totally different way. If you are showing this to i.e. your home page you can add all those field describing your menu to home content type and you can use field collection module which allows you to repeat group of fields. So you can make a group of all fields describing single menu item and make it repeatable. And inside your home template file you'll simply get an array of those field groups / menu item objects.
https://www.drupal.org/project/field_collection
I need to have two navigation portlets (in plone4):
one "classic" (with the settings defined in the plone_control_panel / navigation)
another one with types defined in the navtree portlet instanced
Advices?
Vito
Some tips and ideas.
Copy-paste the existing navigation portlet code to a new portlet.
Then you need to adjust its "navigation tree strategy" so that it collects only content types you define
http://collective-docs.readthedocs.org/en/latest/misc/navigationtree.html#creating-a-custom-navigation-tree
How to create a z3c.form vocabulary to pick out content types:
http://collective-docs.readthedocs.org/en/latest/functionality/controlpanel.html#content-type-choice-setting
I have limited space for horizontal category navigation bar on top of my theme and I need to limit number of categories shown on this bar and tell WordPress put "More.." as a drop down menu link at the end of the list to let users hover their mouse cursors on that to see other categories as shown in screenshot.
How can I do that?
Depends on what function you're using to format the navigation menu. It's probably wp_list_categories() which might not be the best choice in your case. As #Andre mentioned in his answer, you might want to go with navigation menus available since WordPress 3, but if you need to stick to categories, try get_categories() which will return the categories in a non-formatted way. This will enable you to loop through them in any way that you want, include a counter to limit the general output, and then loop through the rest under the More submenu.
Reference: get_categories
I guess you are using wordpress version 3+.
This is probably not the cleanest way but should work:
Register a custom menu to your template. Watch the 'depth' parameter (because you want the second level)
Go to 'Appearance - Menus'
Create a Custom Menu
Create a 'Custom Link' called 'More...'
add the 'More...' Link with the other categories as sub-categories to the menu.
write your CSS code to only display the second level on hover.
However, I'm not sure if you want the 'More..' menu item to be a linkpage/category. All of that is possible, just add the category/page instead of the 'Custom Link'.
Hope this workaround can solve your problem.
I've implemented taxonomy menu in Drupal, and trying to set it up so that it is pretty easy for the user to add new items to the vocabulary from the create content form instead of having to administer the vocabulary itself.
So far, all I can manage is the default behaviour of displaying the existing items.
Edit:
Enabling the 'tags' option for the vocabulary does not allow the desired effect - I want the parent/child structure and drop-down menu in the create content form as well as the ability to add a new tag to that drop-down.
A bit more explanation as to why - I'm trying to create an image gallery using a hierarchy of tags (so, sports > soccer > match on 31st May) - the problem is that the general content creator for the site is non-technical, and I'd like to avoid having to make them work through the taxonomy/vocabulary items interface directly.
I think you're looking for the Hierarchical Select module.
Take a look at the last demo at the following page:
http://wimleers.com/demo/hierarchical-select/taxonomy
What you're talking about is called "tags" in Drupal. You want to check the "Tags" checkbox on the vocabulary edit page and that will change the interface on the content entry forms so users can add new terms/tags.