{"id":48926,"date":"2017-07-17T14:09:50","date_gmt":"2017-07-17T08:39:50","guid":{"rendered":"https:\/\/2thenew.today\/blog\/?p=48926"},"modified":"2021-09-06T11:56:15","modified_gmt":"2021-09-06T06:26:15","slug":"drupal-8-frequently-used-services-functions-statements","status":"publish","type":"post","link":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/","title":{"rendered":"Drupal 8 Frequently Used Services, Functions, and Statements"},"content":{"rendered":"<p>In <a title=\"Drupal Consulting Services\" href=\"https:\/\/2thenew.today\/wcm\/drupal-development-consulting-services\">Drupal 8<\/a>, some important services, functions and statements are frequently used in all projects. These are time-saving statements and perform a very crucial operation. Drupal 8 have multiple statements that are very useful in the project and it is also essential for the performance &amp; Drupal 8 standard.<\/p>\n<p><strong>Drupal 8<\/strong> follow a PSR-4 standard, so Drupal 8 recommended the use of the PSR-4 standard code for the better performance. Drupal 8 provides a lot of services, statements &amp; functions that are very prominent for a big project where <a title=\"Best Practices to Optimize Performance in Drupal 8\" href=\"https:\/\/2thenew.today\/blog\/best-practices-to-optimize-performance-in-drupal-8\/\">performance is the priority<\/a>. We need these statements very frequently in Drupal 8 projects and we start searching on Google, which is a very time-consuming task and sometimes it is not possible when you are working offline.<\/p>\n<p>In Drupal 8 project, these statements\/services play very a vital role in performance, stability, and reusability because these are short line code and increases code reusability.<\/p>\n<p><em>In Drupal 8, a service is any object managed by the services container.<\/em><br \/>\nDrupal 8 introduces a new concept of services to <a href=\"https:\/\/2thenew.today\/blog\/is-your-drupal-8-ready-for-writing-codes\/\">decouple reusability<\/a> and makes these services pluggable and replaceable by registering them with a service container. It&#8217;s a best practice to use these services provided by Drupal 8. <em>The Symfony 2 documentation has a wide introduction to services.<\/em><\/p>\n<h2>Following are frequently used statements, services and functions:<\/h2>\n<p><strong>1. Drupal 8, How to get Node alias or Taxonomy Alias by Node id or Term ID?<\/strong><\/p>\n<p>[php]<br \/>\nuse Drupal\\Core\\Url;<\/p>\n<p>$options = array(&#8216;absolute&#8217; =&gt; true);<br \/>\n\/\/return node alias<br \/>\n$url = Url::fromRoute(&#8216;entity.node.canonical&#8217;, [&#8216;node&#8217; =&gt; 1234], $options);<\/p>\n<p>\/\/return taxonomy alias<br \/>\n$url = Url::fromRoute(&#8216;entity.taxonomy_term.canonical&#8217;, [&#8216;taxonomy_term&#8217; =&gt; 1234], $options);<br \/>\n[\/php]<\/p>\n<p>Sometimes we need a relative path and sometimes we need an absolute path. Drupal 8 has options parameters where you can pass true or false in an absolute key.<\/p>\n<p><strong>Parameters description:<\/strong><br \/>\n-absolute true will return absolute path.<br \/>\n-absolute false will return relative path.<\/p>\n<p><strong>2. Drupal 8, How to get Node ID or Taxonomy term ID by Drupal alias or path?<\/strong><\/p>\n<p>[php]<br \/>\n$path = \\Drupal::service(&#8216;path.alias_manager&#8217;)-&gt;getPathByAlias(&#8216;\/alias-path&#8217;);<br \/>\nif(preg_match(&#8216;\/node\\\/(\\d+)\/&#8217;, $path, $matches))<br \/>\n$nodeID = $matches[1];<\/p>\n<p>$path = \\Drupal::service(&#8216;path.alias_manager&#8217;)-&gt;getPathByAlias(&#8216;\/alias-path&#8217;);<br \/>\nif(preg_match(&#8216;\/taxonomy\\\/term\\\/(\\d+)\/&#8217;, $path, $matches)) {$termID = $matches[1];}<\/p>\n<p>$path = \\Drupal::service(&#8216;path.alias_manager&#8217;)-&gt;getPathByAlias(&#8216;\/alias-path&#8217;);<br \/>\nif(preg_match(&#8216;\/user\\\/(\\d+)\/&#8217;, $path, $matches)) {$userID = $matches[1];}<br \/>\n[\/php]<\/p>\n<p>If alias-path does not exist, it will return the same argument string.<br \/>\nThe first example will work for the node, the second for the taxonomy, and the third for the users.<\/p>\n<p><strong>3. Drupal 8, How to get the object in the twig file?<\/strong><br \/>\nIf you are looking to print how many objects have <a href=\"https:\/\/2thenew.today\/blog\/overview-of-twig-extentions-in-drupal-8\/\">passed into twig file<\/a>, simply add a line in your .twig file.<\/p>\n<p>[php]<br \/>\n{{ kint() }}<br \/>\n[\/php]<\/p>\n<p><strong>4. How to get the current Path in Drupal 8?<\/strong><\/p>\n<p>[php]<br \/>\n$currentPath = \\Drupal::service(&#8216;path.current&#8217;)-&gt;getPath();<br \/>\n[\/php]<\/p>\n<p>It will return the current path in Drupal 8. For the node pages it return node\/{node id},for taxonomy taxonomy\/term\/{term id}, for user user\/{user id) if exists otherwise it will return the current request URI.<\/p>\n<p><strong>5. How to get Affected rows by Delete or Update statement in Drupal 8?<\/strong><\/p>\n<p>[php]<br \/>\n$query = &#8220;Delete FROM table_name where id=10 &#8220;;<br \/>\n$affectedRows = $this-&gt;database-&gt;query($query,[],array(&#8216;return&#8217; =&gt; Database::RETURN_AFFECTED));<\/p>\n<p>$query = &#8220;Update table_name set couln_name=value where id=10 &#8220;;<br \/>\n$affectedRows = $this-&gt;database-&gt;query($query,[],array(&#8216;return&#8217; =&gt; Database::RETURN_AFFECTED));<br \/>\n[\/php]<\/p>\n<p>The above statements will return the number of rows affected by the SQL statement.<\/p>\n<p><strong>6. How to check whether a module is installed or not in Drupal 8?<\/strong><\/p>\n<p>[php]<br \/>\n$moduleHandler = \\Drupal::service(&#8216;module_handler&#8217;);<br \/>\nif ($moduleHandler-&gt;moduleExists(&#8216;module_name&#8217;)){<br \/>\n\/\/echo &#8220;module installed&#8221;;} else {\/\/echo &#8220;module does not installed&#8221;;}<br \/>\n[\/php]<\/p>\n<p><strong>7. How to get Route name in Drupal 8?<\/strong><\/p>\n<p>[php]<br \/>\n$route = \\Drupal::routeMatch()-&gt;getRouteName();<br \/>\n[\/php]<\/p>\n<p>The above statement will return the Drupal route. It returns an entity.node.canonical for the nodes, system.404 for the 404 pages, entity.taxonomy_term.canonical for the taxonomy pages, entity.user.canonical for the users, and custom route name that we define in modulename.routing.yml file.<\/p>\n<p><strong>8. How to get the current page title in Drupal 8?<\/strong><\/p>\n<p>[php]<br \/>\n$request = \\Drupal::request();<br \/>\nif ($route = $request-&gt;attributes-&gt;get(\\Symfony\\Cmf\\Component\\Routing\\RouteObjectInterface::ROUTE_OBJECT)) {<br \/>\n$title = \\Drupal::service(&#8216;title_resolver&#8217;)-&gt;getTitle($request, $route);}<br \/>\n[\/php]<\/p>\n<p>The above statement will return the current page title. If you use the above statement in the controller, it will also return the page title.<\/p>\n<p><strong>9. How to get the current Document root path in Drupal 8?<\/strong><\/p>\n<p>[php]<br \/>\n$image_path = \\Drupal::service(&#8216;file_system&#8217;)-&gt;realpath();<br \/>\n[\/php]<\/p>\n<p>The above statement will return the current document root path like <em>\/var\/www\/html\/project1<\/em>.<\/p>\n<p><strong>10. How to check the Frontpage in Drupal 8?<\/strong><\/p>\n<p>[php]<br \/>\n$is_front = \\Drupal::service(&#8216;path.matcher&#8217;)-&gt;isFrontPage();<br \/>\n[\/php]<\/p>\n<p>The above statement will return either\u00a0<em>true or false<\/em>. Return True for the Frontpage otherwise false.<\/p>\n<p><strong>11. How to uncache a particular page in Drupal 8?<\/strong><\/p>\n<p>[php]<br \/>\n\\Drupal::service(&#8216;page_cache_kill_switch&#8217;)-&gt;trigger();<br \/>\n[\/php]<\/p>\n<p>The above statement doesn&#8217;t keep the page in cache. You can use this statement in node_preprocess, controller, etc. with the condition. When this line is executed, the page will not go into the Drupal cache.<\/p>\n<p><strong>12. How to redirect third-party URL in Drupal 8?<\/strong><\/p>\n<p>[php]<br \/>\n$response = new \\Drupal\\Core\\Routing\\TrustedRedirectResponse($absolute_url, 300);<br \/>\n;&#8221;&gt;$response-&gt;send();<br \/>\nexit(0);<br \/>\n[\/php]<\/p>\n<p>The above statement will redirect on the third-party website with Redirect permanent status. The URL must have an absolute path like <em>https:\/\/2thenew.today<\/em><\/p>\n<p>All the above statements are helpful in Drupal 8, so you should bookmark this blog page to speed up the project development, maintain the Drupal 8 standard and performance that is the key requirement for any Drupal website.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Drupal 8, some important services, functions and statements are frequently used in all projects. These are time-saving statements and perform a very crucial operation. Drupal 8 have multiple statements that are very useful in the project and it is also essential for the performance &amp; Drupal 8 standard. Drupal 8 follow a PSR-4 standard, [&hellip;]<\/p>\n","protected":false},"author":1038,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":13,"footnotes":""},"categories":[3602,1],"tags":[3601,3604,3603,4638,4405],"class_list":["post-48926","post","type-post","status-publish","format-standard","hentry","category-drupal","category-technology","tag-drupal-8","tag-drupal-8-advantages","tag-drupal-8-features","tag-drupal-8-services","tag-drupal-performance"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"This blog talks about how Drupal 8 make use of services, functions and statements.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Jeet Lal\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Drupal 8 Frequently used Services,Functions and Statement | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"This blog talks about how Drupal 8 make use of services, functions and statements.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Drupal 8 Frequently used Services,Functions and Statement | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"This blog talks about how Drupal 8 make use of services, functions and statements.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/drupal-8-frequently-used-services-functions-statements\\\/#article\",\"name\":\"Drupal 8 Frequently used Services,Functions and Statement | TO THE NEW Blog\",\"headline\":\"Drupal 8 Frequently Used Services, Functions, and Statements\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/jeet-lal1\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2017-07-17T14:09:50+05:30\",\"dateModified\":\"2021-09-06T11:56:15+05:30\",\"inLanguage\":\"en-US\",\"commentCount\":3,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/drupal-8-frequently-used-services-functions-statements\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/drupal-8-frequently-used-services-functions-statements\\\/#webpage\"},\"articleSection\":\"Drupal, Technology, Drupal 8, Drupal 8 Advantages, Drupal 8 Features, Drupal 8 Services, Drupal Performance\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/drupal-8-frequently-used-services-functions-statements\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/drupal-8-frequently-used-services-functions-statements\\\/#listItem\",\"name\":\"Drupal 8 Frequently Used Services, Functions, and Statements\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/drupal-8-frequently-used-services-functions-statements\\\/#listItem\",\"position\":3,\"name\":\"Drupal 8 Frequently Used Services, Functions, and Statements\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/jeet-lal1\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/jeet-lal1\\\/\",\"name\":\"Jeet Lal\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/drupal-8-frequently-used-services-functions-statements\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/04402a73-0809-43d7-9c19-eb42257f85cf_523-Jeet-Lal-PROFILEPICTURE.jpeg\",\"width\":96,\"height\":96,\"caption\":\"Jeet Lal\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/drupal-8-frequently-used-services-functions-statements\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/drupal-8-frequently-used-services-functions-statements\\\/\",\"name\":\"Drupal 8 Frequently used Services,Functions and Statement | TO THE NEW Blog\",\"description\":\"This blog talks about how Drupal 8 make use of services, functions and statements.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/drupal-8-frequently-used-services-functions-statements\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/jeet-lal1\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/jeet-lal1\\\/#author\"},\"datePublished\":\"2017-07-17T14:09:50+05:30\",\"dateModified\":\"2021-09-06T11:56:15+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Drupal 8 Frequently used Services,Functions and Statement | TO THE NEW Blog","description":"This blog talks about how Drupal 8 make use of services, functions and statements.","canonical_url":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/#article","name":"Drupal 8 Frequently used Services,Functions and Statement | TO THE NEW Blog","headline":"Drupal 8 Frequently Used Services, Functions, and Statements","author":{"@id":"https:\/\/2thenew.today\/blog\/author\/jeet-lal1\/#author"},"publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"},"datePublished":"2017-07-17T14:09:50+05:30","dateModified":"2021-09-06T11:56:15+05:30","inLanguage":"en-US","commentCount":3,"mainEntityOfPage":{"@id":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/#webpage"},"articleSection":"Drupal, Technology, Drupal 8, Drupal 8 Advantages, Drupal 8 Features, Drupal 8 Services, Drupal Performance"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.today\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/2thenew.today\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/#listItem","name":"Drupal 8 Frequently Used Services, Functions, and Statements"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/#listItem","position":3,"name":"Drupal 8 Frequently Used Services, Functions, and Statements","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.today\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.today\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.today\/blog\/author\/jeet-lal1\/#author","url":"https:\/\/2thenew.today\/blog\/author\/jeet-lal1\/","name":"Jeet Lal","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/04402a73-0809-43d7-9c19-eb42257f85cf_523-Jeet-Lal-PROFILEPICTURE.jpeg","width":96,"height":96,"caption":"Jeet Lal"}},{"@type":"WebPage","@id":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/#webpage","url":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/","name":"Drupal 8 Frequently used Services,Functions and Statement | TO THE NEW Blog","description":"This blog talks about how Drupal 8 make use of services, functions and statements.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.today\/blog\/author\/jeet-lal1\/#author"},"creator":{"@id":"https:\/\/2thenew.today\/blog\/author\/jeet-lal1\/#author"},"datePublished":"2017-07-17T14:09:50+05:30","dateModified":"2021-09-06T11:56:15+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.today\/blog\/#website","url":"https:\/\/2thenew.today\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Drupal 8 Frequently used Services,Functions and Statement | TO THE NEW Blog","og:description":"This blog talks about how Drupal 8 make use of services, functions and statements.","og:url":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/","og:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Drupal 8 Frequently used Services,Functions and Statement | TO THE NEW Blog","twitter:description":"This blog talks about how Drupal 8 make use of services, functions and statements.","twitter:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"48926","title":"Drupal 8 Frequently used Services,Functions and Statement | #site_title","description":"This blog talks about how Drupal 8 make use of services, functions and statements.","keywords":[],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"blog","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"#aioseo-article-65e040ada453c","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":{"locations":{"business":{"name":"","businessType":"","image":"","areaServed":"","urls":{"website":"","aboutPage":"","contactPage":""},"address":{"streetLine1":"","streetLine2":"","zipCode":"","city":"","state":"","country":"","addressFormat":"#streetLineOne\n#streetLineTwo\n#city, #state #zipCode"},"contact":{"email":"","phone":"","phoneFormatted":"","fax":"","faxFormatted":""},"ids":{"vat":"","tax":"","chamberOfCommerce":""},"payment":{"priceRange":"","currenciesAccepted":"","methods":""}}},"openingHours":{"useDefaults":true,"show":true,"alwaysOpen":false,"use24hFormat":false,"timezone":"","labels":{"closed":"","alwaysOpen":""},"days":{"monday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"tuesday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"wednesday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"thursday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"friday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"saturday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"},"sunday":{"open24h":false,"closed":false,"openTime":"09:00","closeTime":"17:00"}}}},"limit_modified_date":false,"created":"2021-04-29 12:20:18","updated":"2024-02-29 08:30:37","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.today\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.today\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDrupal 8 Frequently Used Services, Functions, and Statements\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.today\/blog"},{"label":"Technology","link":"https:\/\/2thenew.today\/blog\/category\/technology\/"},{"label":"Drupal 8 Frequently Used Services, Functions, and Statements","link":"https:\/\/2thenew.today\/blog\/drupal-8-frequently-used-services-functions-statements\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/48926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/users\/1038"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/comments?post=48926"}],"version-history":[{"count":2,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/48926\/revisions"}],"predecessor-version":[{"id":53897,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/48926\/revisions\/53897"}],"wp:attachment":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/media?parent=48926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/categories?post=48926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/tags?post=48926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}