This issue is about making it easy to put in-context edit links on anything in Drupal that uses the new page rendering system (nodes and blocks for now - hopefully menus, fields, and other things later). This is based on http://www.d7ux.org/edit-on-page/ - however, this issue is specifically not intended to be about modal dialogs, inline editing, or some of the other, more complicated ideas discussed in that thread. It is, however, a critical step to enable those kinds of things to happen. And hopefully it will be a big usability improvement in its own right...
See the attached screenshot for an example of what this looks like in its initial form. Each user sees links on each object on the page that they have access to edit. The link takes them directly to the page where they can edit this object. After their edits are complete, they are automatically redirected back to the page where they came from.
To use the new system, developers simply need to put an #edit element on the return array of their page callback, which contains the URL of the link to edit the object. There are other optional elements they can include, but that is the only required one. The system automatically figures out whether the current user actually has access to perform the edits and, if so, provides appropriate variables to to the template file to display the edit links (as usual, these variables can be used or modified however you want). In essence, the system is designed to privilege edit links throughout Drupal and make a consistent, simple way for developers to mark different types of objects as editable.
Things that still need work:
- The theming of the edit links is pretty ugly in some places.
- Some of the newer, "non-traditional" blocks in Drupal give odd or confusing edit links (for example, the System Help block, and in some ways the Main Page Content block) but for now I have not tried to exclude them from printing edit links. This could easily be done via hook_block() if we want to.
- There should perhaps be a theme setting or permission that allows toggling off these edit links entirely, since there are certain types of sites and user roles that might not want these links appearing at all.
- As mentioned, the next step is to extend this beyond nodes and blocks. Menus are probably the next easiest target; they would mainly need to be modified to use drupal_render() to return an array within the block that renders them, and then hopefully everything will work pretty nicely. Fields would be really nice as well, but that's more complicated since there is no edit interface for individual fields yet.
Comments are certainly welcome on the overall direction here - thanks :)
|Passed: 13266 passes, 0 fails, 0 exceptions|
|Passed: 13259 passes, 0 fails, 0 exceptions|
|Passed: 13273 passes, 0 fails, 0 exceptions|
|Passed: 13288 passes, 0 fails, 0 exceptions|
|Passed: 13262 passes, 0 fails, 0 exceptions|