Timeline for Retrieve Asset Filename from an entry, inside a matrix field
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:51 | history | edited | CommunityBot |
replaced http://craftcms.stackexchange.com/ with https://craftcms.stackexchange.com/
|
|
Feb 8, 2015 at 3:48 | comment | added | carlcs | Now it's 'widgetFile' for your Entries Field handle, not 'widgetPrimary' any more, @Jeremiah? Good to see you got this sorted. | |
Feb 8, 2015 at 3:36 | comment | added | Jeremiah | I should mention that the following code works for the text section in my Matrix field. Additionally, the last line {{ block.widgetFile[0] }} shows the TITLE of the linked entry, {{ block.widgetFile[0].id }} shows the ID of the linked entry. Here is the code: {% for block in entry.contentPrimary %} {% switch block.type %} {% case "text" %} {{ block.text }} {% case "widget" %} {{ block.widgetFile[0] }} So inside the entry pulled from widgetFile, I have an asset field from which I need to pull the filename. | |
Feb 7, 2015 at 18:32 | comment | added | Jeremiah | A plain text field works fine, so I know the matrix field is doing its job at least for text... | |
Feb 7, 2015 at 18:10 | comment | added | carlcs | Do one more thing: add a simple Plain Text Field to your 'widget' Matrix Block Type and see if this works (remove the 'widgetPrimary' field's part from the template for this). | |
Feb 7, 2015 at 18:05 | comment | added | carlcs | But to stay on topic, triple check if the field handle of your Entries Field is 'widgetPrimary' and if this field is really available in your Matrix Block Type 'widget'. | |
Feb 7, 2015 at 18:01 | comment | added | carlcs | It's a sign, @Jeremiah. Your Craft site wants you to not use this strange Assets / EntriesField setup only to load template partials. Just do yourself a favor and refactor this whole thing ;) | |
Feb 7, 2015 at 17:57 | comment | added | Jeremiah | So strange, all 4 criteria for the field handles match up. I tried the revised code you just posted and it returns the following still: Internal Server Error Craft\MatrixBlockModel and its behaviors do not have a method or closure named "widgetPrimary". | |
Feb 7, 2015 at 17:55 | history | edited | carlcs | CC BY-SA 3.0 |
added 254 characters in body
|
Feb 7, 2015 at 17:43 | history | answered | carlcs | CC BY-SA 3.0 |