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.
Here is a patch that creates new procedural wrappers for all of the CRUD functions so far. I haven't touched the import/export methods yet as there haven't been implemented yet in the Exportable classes. I have removed any existing function that I don't think we need now as they have new wrappers (ctools_exportable_*) or now live in the classes.
I'm not sure if this is entirely what we want to do right now (removing so much), just trying to make the file more manageable whilst creating the new functions.
Comment | File | Size | Author |
---|---|---|---|
#15 | 1612466-15.patch | 4.41 KB | damiankloip |
#14 | 1612466-14.patch | 4.44 KB | damiankloip |
#13 | 1612466-13.patch | 4.34 KB | damiankloip |
#11 | 1612466-11.patch | 4.34 KB | damiankloip |
#8 | 1612466-8.patch | 4.13 KB | damiankloip |
Comments
Comment #1
damiankloip CreditAttribution: damiankloip commentedtagging...
Comment #2
dawehnerJust wondering why it is called _new not _create, but sure it was named like that already before.
the Drupal\ctools\ExportableInterface could be forced here, as well on the docu of the functions above.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedWe can add a _create to go with _new -- it's the problem of language when essentially merging multiple code paths.
Comment #4
damiankloip CreditAttribution: damiankloip commentedThere are already _new and _create function in this patch. At the moment _new just calls the create() method on the controller but assumes no values will be passed in. The _create function has a $values parameter.
I was going to save any type hinting for another issue. Makes sense to have a patch/issue that deals with this solely?
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedWe can remove reset entirely. That's an artifact of when we just used to use statics and is no longer needed this way.
Minor documentation mismatch
Also, actually removing the old _crud functions will break Views until we are able to update it to the new functions, so we should make that a separate patch.
Comment #6
damiankloip CreditAttribution: damiankloip commentedOk, here is a new patch, taking into account the points in #5 and keeping all of the existing functions for now.
Comment #7
dawehnerAs we change the signature shouldn't be change the docs of the function as well?
another nitpick ... > 80 chars
Comment #8
damiankloip CreditAttribution: damiankloip commentedHere is a new version that addresses dawehners points in #8, and adds type hinting to the CRUD functions
Comment #9
merlinofchaos CreditAttribution: merlinofchaos commentedLooks good. I didn't nitpick it like dawehner though so perhaps he should nitpick it again to be safe.
Comment #10
aspilicious CreditAttribution: aspilicious commentedWill leave this rtbc.
But... ;)
CreateS, same for all the other functions.
@param string "I guess"
@param bool
I wouldn't add the "which is the default" part. And what happens with False. the opposite? or something else?
Does this return a Drupal\ctools\ExportableInterface object?
@return array
@return int|bool (if SAVED_NEW is an integer)
Comment #11
damiankloip CreditAttribution: damiankloip commentedThanks aspilicious, might as well quickly make those changes too :)
Comment #12
aspilicious CreditAttribution: aspilicious commentedLoadS
@return array
SaveS
DeleteS
ChangeS
Thats what I mean by "same for all the function ;)"
Comment #13
damiankloip CreditAttribution: damiankloip commentedoops!
Comment #14
damiankloip CreditAttribution: damiankloip commentedSome more small changes.
Comment #15
damiankloip CreditAttribution: damiankloip commented.
Comment #16
dawehnerThe things i saw got fixed by the last patch.
Comment #17
damiankloip CreditAttribution: damiankloip commentedThanks all for reviews, committed: http://drupalcode.org/project/ctools.git/commit/305f565