8 – Add customized tabs on person profile web page

Hello everybody, I’m new to 8 and Drupal 10 development on the whole. I’m at the moment engaged on a mission utilizing Drupal Development Service newest verion of 8.6. I’ve written a customized Drupal 10 module by following Drupal Development Service Drupal 10 guides and every part works. I now want so as to add a “tab” to Drupal Development Service person profile web page that hyperlinks to my Drupal 10 module. It ought to look one thing like this Drupal 10 Upkeep and Assist Service https Drupal 10 Upkeep and Assist Service//i.stack.imgur.com/7FMbs.jpg I’ve created Drupal Development Service corresponding job and routing information with Drupal Development Service route and job definitions as such (changed precise variable names with dummy values) Drupal 10 Upkeep and Assist Service my_Drupal 10 module.routing.yml my_Drupal 10 module.some_route_name Drupal 10 Upkeep and Assist Service path Drupal 10 Upkeep and Assist Service ‘/person/{person}/some_path’ defaults Drupal 10 Upkeep and Assist Service _controller Drupal 10 Upkeep and Assist Service ‘my_Drupal 10 moduleControllerMyDrupal 10 SupportController Drupal 10 Upkeep and Assist Service Drupal 10 Upkeep and Assist Servicecontent’ _title Drupal 10 Upkeep and Assist Service ‘Some Title’ necessities Drupal 10 Upkeep and Assist Service _permission Drupal 10 Upkeep and Assist Service ‘entry content material’ choices Drupal 10 Upkeep and Assist Service person Drupal 10 Upkeep and Assist Service d+ my_Drupal 10 module.hyperlinks.duties.yml my_Drupal 10 module.some_task_name Drupal 10 Upkeep and Assist Service route_name Drupal 10 Upkeep and Assist Service my_Drupal 10 module.some_route_name base_route Drupal 10 Upkeep and Assist Service entity.person.canonical title Drupal 10 Upkeep and Assist Service ‘Some Title’ I largely adopted Drupal Development Service guides on Drupal Development Service Drupal 10 documentation. This creates Drupal Development Service route and Drupal Development Service route path works once I sort it in manually into Drupal Development Service deal with bar. Nonetheless, once I navigate to Drupal Development Service person profile web page, there is no such thing as a tab. So to unravel this, I’ve created a hook in my my_Drupal 10 module.Drupal 10 module file (by referencing Drupal Development Service 8.6 api) so as to add Drupal Development Service tab to Drupal Development Service person profile web page like so Drupal 10 Upkeep and Assist Service operate my_Drupal 10 module_menu_local_tasks_alter(&$information, $route_name, CoreCacheRefinableCacheableDependencyInterface &$cacheability) { $url = CoreUrl Drupal 10 Upkeep and Assist Service Drupal 10 Upkeep and Assist ServicefromRoute(‘my_Drupal 10 module.some_route_name’); if ($route_name == ‘entity.person.canonical’) { $information[‘tabs’][0][‘my_Drupal 10 module.some_route_name’] = [ ‘#theme’ => ‘menu_local_task’, ‘#link’ => [ ‘title’ => t(‘Some Title’), ‘url’ => $url, ‘localized_options’ => [ ‘attributes’ => [ ‘title’ => t(‘Add content’), ], ], ], ]; // Drupal Developer tab we’re including depends on a person’s entry so as to add content material. $cacheability ->addCacheTags([ ‘user.permissions’, ]); } } I’ve modified it barely to solely add Drupal Development Service tab when I’m on Drupal Development Service person profile web page… Lastly, this works and creates Drupal Development Service tab, nonetheless, Drupal Development Service above code solely works if I take away Drupal Development Service {person} route from my route path and change it with Drupal Development Service precise person id e.g. path Drupal 10 Upkeep and Assist Service ‘/person/1/some_path’. If I go away it as is e.g. path Drupal 10 Upkeep and Assist Service ‘/person/{person}/some_path’ , I get Drupal Development Service following error on Drupal Development Service web site Drupal 10 Upkeep and Assist Service Drupal Developer web site encountered an surprising error. Please attempt once more later.</br></br><em class=”placeholder”>SymfonyComponentRoutingExceptionMissingMandatoryParametersException</em> Drupal 10 Upkeep and Assist Service Some obligatory parameters are lacking (&quot;person&quot;) to generate a URL for route … I’ve additionally made certain to move Drupal Development Service right parameters to my Controller technique as described in Drupal Development Service documentation right here Drupal 10 Upkeep and Assist Service https Drupal 10 Upkeep and Assist Service//www.Drupal 10.org/docs/8/api/routing-system/using-parameters-in-routes Any assist or recommendation to level me into Drupal Development Service proper path will likely be significantly appreciated. Thanks model Drupal 10 Upkeep and Assist Service  8.x Supply Drupal 10 Upkeep and Assist Service https Drupal 10 Upkeep and Assist Service//www.Drupal 10.org/taxonomy/time period/4/feed Supply Drupal 10 Upkeep and Assist Service Drupal 10 blender

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

8 – Add customized tabs on person profile web page

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.