12/5/2023 0 Comments Profile2 drupal tutorialClick on Apply to save the contextual filter, then click on Save to save the view. Under “ Access operation to check” select Edit.ĥ.Check “Validate user has access to the User”.Select the “Provide default value” radio button and choose “User Id from route context” Search for “Authored by” in the Content category and click on Add.ģ. While on the Views edit page, click on Advanced then Add next to Contextual filters.Ģ. Let’s now add a contextual filter which will use the argument and only display articles which are authored by the user ID.ġ. The %user argument getting passed through the URI is not being used at this point. If you go to /user/%user/my-articles replace %user with any number, it should return a table of articles. Fill in the “Add view” form with the values defined in Table 1.0.ģ. Go to Structure, Views and click on “Add view”.Ģ. The owner of the content is defined by the user added to the “Authored by” field on the content edit page.ġ. This page will display a table of articles which is owned by the user, we’ll call it “My articles” and the URI to the page will be /user/%user/my-articles the %user argument will be the user ID which will be used by the contextual filter. The first bit of work we need to do is create an actual Views page. If it’s not already installed, go to Extend and install Views and “Views UI”. In Drupal 8, Views ships with core and will be automatically installed if you installed Drupal using the Standard installation profile. For once there are no extra modules to download and install.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |