Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am building more Service classes and want to improve the UI.
I was able to add a simple "name" property to the hostingService classes, then output that in the form.
Comment | File | Size | Author |
---|---|---|---|
#20 | 2714561-hostingService-name.patch | 8.03 KB | Jon Pugh |
#18 | servicesnames.png | 18.57 KB | Jon Pugh |
#5 | 2714561-hostingService-name.patch | 5.78 KB | Jon Pugh |
#3 | 2714561-hostingService-name.patch | 6 KB | Jon Pugh |
Comments
Comment #3
Jon PughComment #5
Jon PughComment #6
gboudrias CreditAttribution: gboudrias at Praxis Labs Coop commentedSeems like a great idea, but does it require updating the hook_hosting_services() implementations? eg this.
I'm guessing we don't need to, but just making sure.
Comment #7
Jon PughNope, in fact you can't mess with hook_hosting_service() without major refactoring.
That hook is where I started. Had to really hack up the module_invoke() when it hit me that we should just keep the metadata in the class itself.
Comment #8
gboudrias CreditAttribution: gboudrias at Praxis Labs Coop commentedYeah, figures. I don't see a problem with this patch but I'd like others to comment if possible since it's a complicated area of the code.
Comment #9
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedI get a number of these warnings after merging this branch....
Warning: Missing argument 1 for hostingService::__construct(), called in /var/aegir/hostmaster-2016-04-19_13-56/profiles/hostmaster/modules/aegir/hosting/server/hosting_server.module on line 406 and defined in __construct() (line 15 of /var/aegir/hostmaster-2016-04-19_13-56/profiles/hostmaster/modules/aegir/hosting/server/hosting_server.service.inc).
The constructor currently likes to get a $node parameter ....
Comment #10
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commented+1 otherwise though
Comment #12
Jon PughAdded $node argument.
Comment #13
ergonlogicWhy are we instantiating the classes again? If the node exists,
$node->services
ought to contain service objects. Otherwise, they're already being instantiated a little further down in hosting_services_new_object().Could we default
$serviceClass->name
to$type
in hostingService::__construct? Or perhaps add a getter function for that (e.g.,hostingService::getName()
)? That way, it'd consistently be set within the object, rather than having to redo that check wherever we might want to display it.Should we perhaps differentiate between the
$name
we get back from hosting_server_services() and$serviceClass->name
? That is, consistently call (at least one of) them$machine_name
and/or$serviceClass->humanName
, respectively.Finally, I think we'd also want to use these human names as the column header is our servers view, no?
Comment #14
ergonlogicComment #16
Jon PughAll suggestions implemented, except the last one about the column headers.
Will work on that after Pizza!
Comment #18
Jon PughComment #19
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedSorry but the 2714561-hostingService-name branch gives a merge conflict.
Comment #20
Jon PughComment #21
Jon PughPushed to the branch as well.
Comment #23
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedThanks, Looks much nicer on /hosting/servers
Comment #25
Jon PughThis seems unmerged: https://git.drupalcode.org/project/hosting/compare/7.x-3.x...2714561-hos...
Comment #27
Jon Pugh