isellsoap Posted August 2, 2013 Share Posted August 2, 2013 See screenshot for a better understanding of my question: I have lots of generic field names per template (the generic naming is for scalability/simplicity reasons and necessary), so it would be nice to have the field label show up besides the field name for better overview. Is this possible? The status quo is ok-ish, but the field label showing up would be neat, faster and save me some clicks. 1 Link to comment Share on other sites More sharing options...
diogo Posted August 2, 2013 Share Posted August 2, 2013 Go the template "advanced" tab, and add the fields you want to the "List of fields to display in the admin Page List" input Link to comment Share on other sites More sharing options...
kongondo Posted August 2, 2013 Share Posted August 2, 2013 Go the template "advanced" tab, and add the fields you want to the "List of fields to display in the admin Page List" input Diogo, Am not sure that's what he's after? The screenshot is of the Tempate->Basics screen where you can add fields to the template. He wants those rows/list of fields (the asmList), in addition to the field name, to show the field label. What you are suggesting is for the Page Tree, no? Link to comment Share on other sites More sharing options...
ryan Posted August 4, 2013 Share Posted August 4, 2013 Currently you can't show field labels rather than names in the template editor. This part is meant to be for the developer, who would typically know fields by their names rather than labels. Like in your template files, you'd refer to fields here by their names. Field labels are more for clients, language translation, etc. I would suggest using more descriptive names than float_field_1, float_field_2, etc., because there's no way to tell what that is, outside of the label. It could make the code in your site's template files difficult to maintain and navigate. Link to comment Share on other sites More sharing options...
isellsoap Posted August 5, 2013 Author Share Posted August 5, 2013 Thanks for the comments. @ryan: like I wrote in the first post, the generic names are necessary because of scalability reasons in the long run. The fields represent single entries of companies’ quarterly results. Because of the heterogenity of those results (every company has slightly different naming conventions for their financial stuff), it wouldn’t be very wise to create 30 to 50 fields per company (that would result in 30,000 to 50,000 fields for 1,000 companies). Instead, I have 50 generic field names for 1,000 companies. I think also that it is definitely a bit difficult to navigate through template files (in my case the fields are used in a module) and check, which field represents what for a single company, but I think it’s far better than having thousands and thousand of fields in total. Link to comment Share on other sites More sharing options...
kongondo Posted August 5, 2013 Share Posted August 5, 2013 I think also that it is definitely a bit difficult to navigate through template files (in my case the fields are used in a module) and check, which field represents what for a single company, but I think it’s far better than having thousands and thousand of fields in total. I can think of different ways to deal with this one. Printout: As someone suggested in the forums (Maybe Renobird?), they print out a list of all the fields on their site and what the fields are for. Admin page: Maybe create a hidden page, under Admin, with a list of all the fields and what they represent for each company? Custom Admin page: Create a custom admin page using Diogo's Admin Custom Page module that renders only for superuser showing you the list of fields and what they represent for each company. Maybe this is best because you can view it as read only and can get as creative as you want with the output Just thinking out loud here... 3 Link to comment Share on other sites More sharing options...
isellsoap Posted August 5, 2013 Author Share Posted August 5, 2013 Super cool ideas, thanks a lot! Point #3 sounds really good. The more I learn about ProcessWire and use it, the more I love it. 2 Link to comment Share on other sites More sharing options...
ryan Posted August 6, 2013 Share Posted August 6, 2013 @ryan: like I wrote in the first post, the generic names are necessary because of scalability reasons in the long run. The fields represent single entries of companies’ quarterly results. Because of the heterogenity of those results (every company has slightly different naming conventions for their financial stuff), it wouldn’t be very wise to create 30 to 50 fields per company (that would result in 30,000 to 50,000 fields for 1,000 companies). Instead, I have 50 generic field names for 1,000 companies. Sounds like you have pretty unique needs here, and I understand now – your approach does make sense given the context. I think Kongondo's ideas are good here, and I will keep thinking about how we might support separate labels in the asmSelect list there for the future. 1 Link to comment Share on other sites More sharing options...
muzzer Posted April 25, 2017 Share Posted April 25, 2017 Similar (related) question. I have templates with up to 50 fields. I don't work in the Admin much but do use it to lookup values on pages and with my poor memory, and even with pretty good naming convention for my fields (some are similar) I often lose track of field names. Is there any way (short of manually appending the field name to the label) to show both label and field name above the field input. Essentially, is there somewhere an option to automatically append the field name to the field label. Please see screenshot for basic idea: Thx Link to comment Share on other sites More sharing options...
tpr Posted April 25, 2017 Share Posted April 25, 2017 Use AdminOnSteroids and enable Field and Template edit links, then hover on field label to see field name in a tooltip, or edit on click. 4 Link to comment Share on other sites More sharing options...
abdus Posted April 25, 2017 Share Posted April 25, 2017 You can do this with a few lines of JS (function(){ let inputs = document.querySelectorAll('.InputfieldWrapper .Inputfield'); [].forEach.call(inputs, item => { let input = item.querySelector('[name]'); if(!input) return; let label = item.querySelector('label'); if(!label) return; let inputName = label.htmlFor.replace(/(\w+)_(\w+)/, '$2'); let span = document.createElement('span'); span.style.display = 'inline-block'; span.style.color = 'tomato'; span.style.border = '2px solid'; span.padding = '0.25em 0.25em'; span.margin = '0 0 0 0.25em' span.innerHTML = inputName; label.appendChild(span); }); })(); Run this in Developer Console on your browser and you'll get this To automate this, you can put this script in a JS file in /site/templates/admin/labels.js, and enqueue it inside your /site/ready.php // /site/ready.php if ($page->template->name === 'admin') { $config->scripts->add($config->urls->templates . 'admin/label.js'); } 5 Link to comment Share on other sites More sharing options...
szabesz Posted April 25, 2017 Share Posted April 25, 2017 I do not have the time to present an exact solution, but I think it is worth to mention that @Robin S came up with something similar using Hanna Codes (it uses the description field for such purposes, but should work in any admin themes): 2 Link to comment Share on other sites More sharing options...
muzzer Posted May 5, 2017 Share Posted May 5, 2017 Hey @abdus, Thank you! I was not aware you could do anything like this! Love it. BTW the ugly styling in my screenshot was just the default from the snipping app, I never meant you to copy it so accurately! Bonus points for that. @tpr thanks for the AdminOnSteriods suggestion, it looks interesting, will check it out. Cool name too. Link to comment Share on other sites More sharing options...
Robin S Posted May 5, 2017 Share Posted May 5, 2017 One more option: when debug mode is true you can hover the inputfield open/close toggle to see the field name. 1 Link to comment Share on other sites More sharing options...
pwfans Posted October 11, 2018 Share Posted October 11, 2018 On 5/5/2017 at 11:47 AM, Robin S said: One more option: when debug mode is true you can hover the inputfield open/close toggle to see the field name. Is there anyway to always enable this whether debug mode is on or off ? this is really usefull. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now