Drupal 7:Pathauto patterns from menu structure hierarchy - drupal

I'm trying to create a Pathauto pattern which looks like "Drupal root/parent_menu_item_name/node_title" where "node_title" is a child of "parent_menu_item_name" in the menu hierarchy.
I've tried many different variations, and nothing works. I've tried the suggestions in Menu path in Pathauto, and none of them works at all. It just ends up outputting the node-title, with nothing before it.
I've got the latest versions of the Token and Pathauto modules installed.

I believe this question has been answered by Kenan:
Kenan's answer
[node:menu-link:parent:url:path]/[node:title]
It works for me, so I'm very happy!

The token combination [node:menu-link:parent:url:alias]/[node:menu-link] shall work with the following modules :
token : 7.x-1.0-beta3
pathauto: 7.x-1.0-rc2
The token patterns seem to vary depending on the version of the token module.

This token uses the menu titles of each parent item to build a url:
[node:menu-link:parents:join-path]/[node:title]
So if you have nested content titled: The Future -> Doc Brown -> Flux Capacitor
The above token will print out:
/the-future/doc-brown/flux-capacitor

This combination works perfectly for me
[node:menu-link:parents:join-path]/[node:menu-link:title]
with the latest token (7.x-1.5) and pathauto (7.x-1.2).

This works for me (for book type nodes): [node:menu-link:parent:title]/[node:title]
Found on: http://www.metachunk.com/blog/drupal-7-path-auto-menu-pattern

Related

How would I create a RouteModule in Angular 2 without forRoot

I am working on going through the Style guide for Angular 2 and I happened upon this line
Do end the filename of a RoutingModule with -routing.module.ts.
I haven't had luck finding anything on routing module examples so I went to Papa's blog. There I found this line...
The forRoot() function should only be used for creating the root modules' routes. When we get to child modules and routes, we'll use other techniques that we'll see in later posts.
So how do I create a RouteModule that isn't using forRoot like suggested.
I think I found an example here...
https://github.com/angular/angular.io/blob/master/public/docs/_examples/ngmodule/ts/app/contact/contact-routing.module.ts

Load resources in gadgets in Jira

I've made an Add-on which is a custom field.
The style of the text in the field changes depending on the properties of an issue.
I check which style should the text have in the .java file and I pass the html class in a variable called $indicator to the velocity template:
#if( ${value} )
<span class="$indicator">${value}</span>
#end
It works perfect everywhere but in gadgets. When I add this field to a table showing issues in a dashboard, the html code is correct, but it doesn't find the css resource. This is because gadgets are inside an iframe.
How can I make the iframe have a reference to the stylesheet?
You did not say exactly which gadget you were using, but try adding the following context within your <web-resource> module:
<context>jira.webresources:issue-table</context>
The above should work for at least Assigned to Me, Filter Results, In Progress, Voted, and Watched in JIRA 6.1+.
If that does not work, you might also try:
<context>com.atlassian.jira.gadgets:common-lite</context>
If that general context doesn't work, you can look for which exact contexts are #requireContext'ed by the specific gadget you are trying to use, and then make sure that your web-resource is listed in that context. You can figure this out by looking at the gadget's XML and then searching for the #requireContext. (You can find the gadget XMLs inside $JIRA_DATA/plugins/.osgi-plugins/transformed-plugins/jira-gadgets-plugin-*.jar)
Starting with JIRA 7 the Answer of Scott Dudley is no longer working. #requireContext was replaced with a #requireResource within the Atlassian sources of this gadget.
As it affects our plugin, I created a Improvement Request to make that possible again

Reset the 'Custom Forms' Content Type in Orchard CMS having issues

I have mixed up the Content Type Custom Forms default settings. And it seems not usable anymore after some tweaks and settings.
Now it seems that I have to reinstall the orchard as whole. I'm in initial stage of the setup so it is possible for me to start afresh but I wanted to know regarding how to reset the Content Type to default settings using Orchard Command line or any other simpler way.
Please note: There is a question on deleting a Content Type here but it seems that is also not answered yet. From an youtube video here I found to command to enable or disable the modules using command such as feature enable <ModuleName>
But how to reset the Content Type that is still the question.
I have very short timeline for building the things now, and researching is taking too much time.
Hint or Help towards the solution would be kind of you.
If you take a look in the Migrations.cs of the CustomForms module source code, online here, you can see what parts are being added to it.
So the relevant code is
ContentDefinitionManager.AlterTypeDefinition("CustomForm",
cfg => cfg
.WithPart("CommonPart")
.WithPart("TitlePart")
.WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "true")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Title', Pattern: '{Content.Slug}', Description: 'my-form'}]")
.WithSetting("AutorouteSettings.DefaultPatternIndex", "0"))
.WithPart("MenuPart")
.WithPart("CustomFormPart")
.DisplayedAs("Custom Form")
.Draftable()
);
The parts are therefore:
CommonPart
TitlePart
AutoroutePart
MenuPart
CustomFormPart
I would recommend taking a look at this tutorial if you are having any problems: DevDirective
Do you really need to add/remove parts from this Content Type?

Menu path in Pathauto

How do I get pathauto under Drupal 7 to generate a URL alias by the full menu path?
Just an update in case anyone comes across this with a more recent version of Pathauto/Token. This worked for me:
[node:menu-link:parents:join-path]/[node:menu-link]
I ended up using:
[node:menu-link:parent:url:path]/[node:menu-link]
Heavy caution though: If the node does not have a menu link, you'll end up without an automatically aliased page. On the bright side, this might make you aware of orphan pages. (Consider it a feature!)
Note that using the pattern:
[node:menu-link:url:path]/[node:menu-link]
will only give the node's menu link, not that of the parent (which would be needed to reference the parent's path).
Or the pattern:
[node:parent:url:path]/[node:menu-link]
throws an error in my instance of Drupal 7 about invalid tokens (even though I have the token module installed).
[node:menu-link:parent:url:path]/[node:title]
If the node is not in the menu, then it does not create an alias. Otherwise this seems to work for n-tier menus.
I think it has to be this pattern now:
[node:menu-link:url:path]/[node:menu-link]
"path" instead of "alias"
You'll need to install the contrib Token module as well -- although a lot of the features of Token are part of core in D7, some of the edge case tokens (like the full menu path of a given node) aren't provided by core automatically.
With that installed, I believe that [node:menu-link:parent] or [node:menu-link:parent:url] should work.
The pattern that works for me is the following:
[node:menu-link:parent:url:alias]/[node:menu-link]
I also intalled the Token module like Eaten suggested. Don't know if [node:menu-link:parent:url:alias] is part of core or lives in contrib.
If you're attempting to make aliases for pages that are 3rd level or deeper, for example:
Home page
> Level 1 page
> Level 2 page
> Level 3 page
and you want the alias for Level 3 page to look like http://domain.com/level-1/level-2/level-3, I got it to work for me by setting my pattern to:
[node:menu-link:parent:parent:parent:title]/[node:menu-link:parent:parent:title]/[node:menu-link:parent:title]/[node:title]
Notice that I added :parent to the token, and for the first one I added it twice.
Enjoy!
[node:menu-link:parents:join-path]/[node:title].html
This is the solution I use:
[node:menu-link:parents:join:/]/[node:menu-link]
It will separate parent menu items with a dash. That is what I need.
For anyone who stumbles upon this answer, and wonders how to add this:
Configuration > Search and Metadata > URL aliases, then create under "Patterns" tab.

Add a Drupal menu item with a hard coded path to a view that accepts arguments?

I have a view page that accepts a taxonomy term id as an argument at /foo/%bar. I want to add several menu items to the primary links in the form of /foo/actual-bar.
Whenever I try to do this I get the error message "The path '/foo/actual-bar' is either invalid or you do not have access to it."
How can I add such menu items?
Thanks,
Finbarr
Off the top of my head I believe there are a couple ways to do this:
Use absolute URLs (http://yoursite.com/foo/actual-bar) in the menu, which should bypass the check.
Define the links in a custom module using hook_menu()
It does seem to me that there should be a better way to achieve this, but these two options should at least get your going in the short term.
Another way would be to set the url in the view to foo/% it makes the argument required and the 6.x menu system will then see it as a valid URL.
However, just /foo will no longer be a valid URL, so you may need to create another page display in the view to accommodate the URL with no argument.
i recommend set path in such way: /foo/%/bar
so you can access it via: /foo/actual/bar
Oddly, I have a custom module that defines a hook_menu but the menu UI won't allow me to enter it into the system.
Had to do the absolute path solution... though I sure don't like it!

Resources