Problem/Motivation

When using drush enity-type-read node --fields=bundles it's impossible to select ie only the page bundle. As field_info_* are added it could be nice to have a path into the fields.

Proposed resolution

Allow fields option to respect a path like

--fields=bundles/page/admin
--fields=**/label
--fields=**/page/**format

The result should still have the path intact with the resulting array.

Remaining tasks

Implement this.

Comments

clemens.tolboom’s picture

Status: Active » Needs work

The current version supports commands like

drush entity-type-read node annotate --fields='bundles/*/admin/path,bundles/*/admin/real path'

resulting

Array
(
    [node] => Array
        (
            [bundles] => Array
                (
                    [article] => Array
                        (
                            [admin] => Array
                                (
                                    [path] => admin/structure/types/manage/%node_type
                                    [real path] => admin/structure/types/manage/article
                                )

                        )

                    [page] => Array
                        (
                            [admin] => Array
                                (
                                    [path] => admin/structure/types/manage/%node_type
                                    [real path] => admin/structure/types/manage/page
                                )

                        )

                )

        )

    [annotate] => Array
        (
            [bundles] => Array
                (
                    [private] => Array
                        (
                            [admin] => Array
                                (
                                    [path] => admin/structure/annotate/manage/%annotate_type
                                    [real path] => admin/structure/annotate/manage/private
                                )

                        )

                    [editor] => Array
                        (
                            [admin] => Array
                                (
                                    [path] => admin/structure/annotate/manage/%annotate_type
                                    [real path] => admin/structure/annotate/manage/editor
                                )

                        )

                )

        )
clemens.tolboom’s picture

The work lies in having the wildcard as a start. This works ok

drush entity-type-read node annotate taxonomy_term --fields='bundles/*/admin/path'

But have a wildcard upfront fails.

drush entity-type-read node annotate taxonomy_term --fields='*/*/admin/path'
clemens.tolboom’s picture

Status: Needs work » Fixed

I fixed the wildcards.

I like this command drush --debug entity-type-read --fields='**/label' `drush etr` as it gives all keys == 'label'.

clemens.tolboom’s picture

Status: Fixed » Needs work

This command works
drush er node `drush er node` --fields='**/und'

But this fails
drush er node `drush er node` --fields='**/value'

I suspect the [0] index in the result.

[10] => Array
        (
            [body] => Array
                (
                    [und] => Array
                        (
                            [0] => Array
                                (
                                    [value] => Causa decet defui genitus oli
clemens.tolboom’s picture

Status: Needs work » Fixed

This

drush entity-read node 1 --fields=**/und/*/format --yaml
# and
drush entity-read node 1 --fields=**/und/**/format --yaml
body.und.0.format = filtered_html

works fine now.

clemens.tolboom’s picture

Component: Code » Drush-1005480
clemens.tolboom’s picture

Title: Maak fields option respect path like bundles/page/tile » Make fields option respect path like bundles/page/tile

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated the proposed solution.