俺のDrupal

Ore_no Drupal icon
 

A blog that introduces the appeal and utilization of Drupal.
It serves as a source of information to broaden awareness in the world to a large audience.

Drupal: Mr. Worldwide

Other
Drupal: Mr. Worldwide image

Global competition in the cms industry is widely known, and in fact 1.6% of all websites on the Internet run on Drupal, we won’t wonder if famous and large brands or company to choose this platform, besides being robust and well-known for its security features, Drupal is a leading-edge content management system (CMS) that includes many features.

Table of Contents

    And being the software free, Drupal is a beast of a CMS. Its framework and backend architecture are solid, well-tested, and completely water tight. Its basically a well-developed open-source software thats very flexible and scalable. Flexible in a way that allows you to create any content you want and scalable which can use any of the multiple contributors and modules already available for the software. And since its open-source you can make your own custom module the way you want and what you want; and to cut the long story short here are some stunning websites that uses Drupal to back up all the talks:

    Tesla

    The world’s best electric car manufacturer, Tesla was built using drupal which provides a top-tier platform to showcase Tesla’s amazing automobiles, foster community among customers, and share news and product details that looks pretty neat and easy to use.

    NBA

    Knowing the flexibility and the capacity of drupal cms, NBA choose drupal to solve the million visits from the hooper fans and having a feature from real-time scores to live broadcasting, NBA offers also an online game ticket along a souvenir shop from your favorite team and players.

    NASA

    For space lovers, NASA’s website takes us with there exploration and discoveries by providing a superb amount of information, research, news and other things related to the institution. And together with drupal it speeds up the process which leads to having a better user experience

    Rainforest Alliance

    With a smart, simple and beautiful layout with a focus on structured data, Rainforest Alliance together with drupal created a site that makes user have an easy navigation and access to all informations which highlights the Rainforest Alliance intentions.

    Warner Music Group

    Wanting a more flexible platform that can manage massive traffic Warner Music Group choose Drupal and joined 73 percent of the top media companies who are using Drupal including Walt Disney, Time, Fox, and CBS.

    References:

    https://anyforsoft.com/blog/23-famous-drupal-websites/

    https://websitebuilder.org/blog/drupal-statistics/

    https://codecondo.com/10-popular-websites-built-with-drupal-platform/

    https://www.etondigital.com/popular-drupal-projects/

    https://createdbycocoon.com/post/top-10-uses-drupal-2017

    Jessie Allen Anosa

    "Kumusta!". I call myself Jessie! A Filipino nomad raised in Philippines.

    Currently a Front-End Developer here in Acret-PH which is an awesome job that highlights my passion in designing and making things look good. Working here taught me a lot with the challenges and experience new things which helped me grow and continue to thrive to be better and do better, together with the support of the team and management it drives me to push myself to my limits and break my boundaries to be one of the person who will you can count and rely on.

    To sum it all, I'm in my happiest designing and making my living most from it :) — and trust me, I know things.

    How to handle entities in Drupal 8

    Modules
    How to handle entities in Drupal 8 image

    Entities are the main contents of Drupal.

    Table of Contents

      If you have created a Drupal site you have probably worked with all the default entities of Drupal!
      Examples of entities are nodes, user, terms and a lot more.

      Entities in Drupal are treated as objects / models.

      You can identify an entity if it extends the following classes:
          Drupal \ Core \ Entity \ EditorialContentEntityBase; 
          Drupal \ Core \ Entity \ ContentEntityBase;

      You can also tell if its an entity too by the file structure.
      img

       

       

       

       

       

       

       

       

      Now once we identify an entity, here are some usefull methods we can use.
      In the examples below we will be using the User entity. Note that this methods are available to every entity in Drupal like node etc ..

      In this example we want to load an User entity using its ID

          $ id = 1;
          $ user = \ Drupal \ user \ Entity \ User :: load ($ id); // Load user with ID 1

      Now that we loaded our user entity and assigned it to variable "$ user", we can get the value of any field the user entity has.
      In this case we want to get the user's birth date.

          $ bday = $ user-> field_birthdate-> value;
          echo $ bday;

      We can also load multiple entities using entity query which is a Drupal function.
      In this example, we want to load all users which has a birthdate of 09/25/2020

          $ query = \ Drupal :: entityQuery ('user')-> condition ('field_birthdate', '09/25/2020 ');
          $ uids = $ query-> execute ();

          // Now you can use loadMultiple method to load all users with birthday 09/25/2020!
          $users = \Drupal\user\Entity\User::loadMultiple($uids);

      Now since we know how to load a user and get its value, its time for us to update a field value!
      In this example we will be updating a user's name

          // We load the user we want to update
          $user = \Drupal\user\Entity\User::load(1);

          // We use the machine name of the field we want to update
          $user->set('field_username', 'ILoveDrupal');
          $user->save();

      How about if we want to create a user entity programatically!
          
          $ User = \ Drupal \ user \ Entity \ User :: create ([
              'preferred_langcode' =>'ja',
              'preferred_admin_langcode' =>'ja',
              'name' = >'Jane',
              'mail' =>'drupal_lover@acret-ph.com',
              'field_user_points' => '999',
          ]);
          $ user-> save ();

      Note that fields may vary and values ​​will depend on what kind of field you have added to the entity.

      Now we delete a User!
          
          // Delete user with ID 1
          $ user = \ Drupal \ user \ Entity \ User :: load (1);
          $ user-> delete ();

      Gabriel Fernandez

      Born and raised in an island in the Philippines! Never been outside the country (hopefully someday I will)

      Started working at Acret with zero Drupal knowledge, since then with the help from my fellow colleagues I have learned a lot about Drupal development and also a lot more about software development!
      I am still learning as of today so if you have anything to teach, please teach me sensei!

      Create configuration and fetch it in a module

      Modules
      Create configuration and fetch it in a module image

      When developing modules in Drupal, we want to add our module's configuration. The Drupal Core ConfigFactory class is a way to read and write configuration data.

      Table of Contents

        Form definition example (located at sample / src / Form / sampleSettings.php):

        namespace Drupal \ sample \ Form;

        use Drupal \ Core \ Form \ ConfigFormBase;
        use Drupal \ Core \ Form \ FormStateInterface;

        / **
         * Settings / Configuration form for the module
         * /
        class sampleSettings extends ConfigFormBase {

          / ** 
           * {@inheritdoc}
           * /
          public function getFormId () {
            return'sample_settings';
          }

          / ** 
           * {@inheritdoc}
           * /
          protected function getEditableConfigNames () {
            return [
              'sample_settings.settings',
            ];
          }

          / ** 
           * {@inheritdoc}
           * /
          public function buildForm (array $ form, FormStateInterface $ form_state) {
            $ config = $ this-> config (sample_settings.settings);

            $ form ['site_name'] = [
              '#type' =>'textfield',
              '# title' => $ this-> t ('Enter the site name'),
              '# required'=> TRUE,
              ' # default_value '=> $ config-> get ('site_name'),
            ];  

            return parent :: buildForm ($ form, $ form_state);
          }

          / ** 
           * {@inheritdoc}
           * /
          public function submitForm (array & $ form, FormStateInterface $ form_state) {
              $ submit_data = $ form_state-> getValues ​​();
            // Retrieve the configuration.
                $ This-> config ('custom_fetch_ftp. settings')-> set ('site_name', $ submit_data ['site_name'])-> save ();

            parent :: submitForm ($ form, $ form_state);
          }
        }

        In this way we can fetch our configurations anywhere in our Drupal codebase like this

        $ config = \ Drupal :: config ('sample_settings.settings');
        $ site_name = $ config-> get ('site_name');

        Gabriel Fernandez

        Born and raised in an island in the Philippines! Never been outside the country (hopefully someday I will)

        Started working at Acret with zero Drupal knowledge, since then with the help from my fellow colleagues I have learned a lot about Drupal development and also a lot more about software development!
        I am still learning as of today so if you have anything to teach, please teach me sensei!

        Top 5 Useful commands from Drush

        Server-side
        Top 5 Useful commands from Drush  image

        Table of Contents

          Drush have lots of useful commands for interacting with code like modules / themes
            it can executes SQL queries and DB migrations, it can also run cron or clear cache. 
            Developers which is begginer level have not to worry using Drush because it can be able to understand Easy
            Developers which is intermidiate to advance level can be very useful specially for debugging purposes.
            
            Here are the list of most usefull drush commands:
            1. drush updb - Stands    for "Update Databse", when the site has something went wrong or you delete the module that has enabled, just run this command to fix the issue.
            2. drush cr     --Stands for "Clear Cache", It is useful for creating twig files, css and js 
            3. drush uli - Stands     for User Login, when you forgot youre admin username and password, you can use this command and it will show the url with of 1 time mix token login
                                  . Ex http: // default / user / reset / 1/1601374003 / YFF4QQMPTNtzDI4UYyjVAMkV9pUjrMqKmRCrSiJWV84 / login, The replace {Youre_site} / user / reset / 1/1601374003 / YFF4QQMPTNtzDI4UYyjVAMkV9pUjrMqKmRCrSiJWV84 / login
            4. drush php     - This COMMAND Will run a php shell which accepts php scripts with drupal, this is useful for debugging backend logic or getting data from database using drupal php library 
                              Ex. get email from user id 1 
                                  User = $ \ Drupal \ User \ Entity \ User :: Load (1);
                                  $ Email = $ User-> GetEmail ();
                                  print_r ($ Email);

                                  
            5. drush sql:connect -  This command is useful for importing or updating database from cloud to local 
                                Example code :
                                Step 1: drush sql:cli 
                                Step 2: mysql --user=drupaluser --password= --database=renify --host=127.0.0.1 --port=33067 -A
                                Step 3: source {db_name.sql}   

          Renier John Sediego

          Hello everyone and welcome to my Profile . My name is Renier and my life was started when I was born and raise not in Cebu but in Negros Island with simple life and living. I like solving problems where my knowledge capacity is hitting hard. I always do sports activities like bicycling , jogging and other physical activities to boost not only my immune system but also my mental state . I also love to hear party musics specially when i'm do coding stuff because I'm feel more focused and alive.

          How to install drupal9

          Other
          How to install drupal9 image

          If you have experienced installing Drupal 8 then installing Drupal 9 should be easy for you. However, we will take into consideration those who are new to Drupal so I will use simple terms to be easily understood by all. This tutorial will also be focused on a local installation of Drupal for development purposes on mac and windows.

          Table of Contents

             

            Prerequisites

            Before you can run drupal 9 on your local computer, you need to have the following

            1. Apache, Nginx or IIS
            2. PHP (at least version 7.3 or higher for better compatibility)
            3. MySQL or Percona (version 5.7.8 same reason as above)

             

            If you think the above list is a pain to gather, then you should be thankful because there are free software that have all of the above and some have more. But for this tutorial we will be using two of our favorite xAMP stacks, the Acquia Dev Desktop and XAMPP.

             

            Installing these two requires a tutorial on their own but you can go to these links for guidance.

             

            Installing Drupal 9 using Acquia Dev Desktop

             

            Once you’re done installing acquia dev desktop (ADD), you are now ready to install Drupal 9. Just follow the next simple steps to install and run your local Drupal 9.

             

            Download

            Off course you have to download Drupal first before installing. You can get the latest version from this link : https://www.drupal.org/download

             

             

            Extract

            After downloading Drupal, extract the files to your preferred folder. In this example we will extract it inside the Local User’s folder => Sites => devdesktop. You can rename the folder to your project if you want.

             

             

            Setup

            Launch your acquia dev desktop software and follow the steps below

            • Click the [ + ] button located at the lower left portion of the acquia dev desktop window
            • Select the “Import local Drupal site…”

            • Click the “Change...” button and browse to the directory where you extracted the Drupal 9 Core files
            • The settings will be populated and we will just use the default settings

            • Click “OK” button and that’s it for the acquia dev desktop setup
            • Launch the site by clicking the local site link
            • This will open a new browser session

             

            Configure

            Once your local site opens up in your browser session, you can now start configuring the site.

            • Select your language

            • On the next screen we will select “Standard” for our example but you are free to choose for your own purpose.

            • Click “Save and continue” and the Drupal 9 installation will continue
            • You will see the below and all you need to do is wait for the next window

            • Fill out the site details and click “Save and continue”

            • Your Drupal 9 installation is complete when you see the below window.

             

             

            Installing Drupal 9 using XAMPP

             

            Installing Drupal 9 using XAMPP on windows is almost the same process as installing it using Acquia Dev Desktop. The only difference is that you will need to configure a few other things for the process to proceed.

             

            Creating a database in phpmyadmin

            • Launch your xampp application
            • Start Apache and MySQL
            • Click “Admin” and your default browser should open to the locahost/phpmyadmin
            • In the phpmyadmin dashboard, click “New” on the left pane to create a new database

            • Then type-in the database name of your choice
            • Click “Create” and we’re all set
            • (Optional) if you want to add a database password you can do so but is totally not required

             

            Extract

            • Extract the Drupal 9 files to your xampp htdocs directory
            • In our case the path is C:\xampp\htdocs\ore-no-drupal
            • Remember the directory name of your extracted Drupal 9 application because you will use that for the next step

             

            Configure Drupal

            • To configure drupal, you need to open your favorite browser and type-in localhost/(your_drupal_directory_name)
            • Once there you can proceed with the same steps as above
            • Depending on your installation, you may hit a warning about opcache

            • This part is optional but it’s good to have
            • If you would like to proceed, just scroll down to the bottom and select “continue anyway”
            • But if you want to enable it open your xampp control panel and click “Config” on Apache

            • Select “PHP (php.ini)” and open it with your preferred text editor
            • Just follow the steps described here and you should be good to go: https://www.drupal.org/forum/support/post-installation/2016-03-03/drupal-8-opcache-warning-php-opcode-caching-not-enabled
            • Restart Apache by clicking “Stop” and “Start” under actions in your xampp control panel
            • On the Drupal 9 configuration browser session, click “retry”.
            • Once that is done you will be asked for the database information from the previous steps
            • Wait for the process to complete and that’s it! Congratulations on your new Drupal 9 installation

             

             

            Jeffy Lepatan

            I come from a small, underserved part of Cebu — a place that taught me the power of grit, gratitude, and giving back. As the eldest of seven, I’ve always believed in sharing success, a value I now bring into my role as a general manager.

            I’m endlessly grateful to our CEO for believing in me and giving me the chance to be part of something bigger than myself. As a developer, I push myself to create software that helps people connect and navigate the digital world more easily. And as a leader, I do my best to create an environment where we grow together — where we’re motivated not just by results, but by purpose, gratitude, and the joy of building something meaningful as a team.

            Years ago, I dreamed of exploring the world — even imagining the possibility of doing it through VR. Today, I’ve been blessed to travel and see new places with my own eyes, and I still believe that technology can make the impossible possible. If we can imagine it, and work together, there’s no limit to what we can create — or where we can go.

            Fun Drupal Modules? Say No More! (Editor’s Choice)

            Modules
            Fun Drupal Modules? Say No More! (Editor’s Choice) image

            Most of the websites today highly considers a good user experience and better navigation for ease of use, and in many cases to achieve this, many libraries are called and implemented which may cause some failure in the websites performance. But with drupal and its modules we can ease the tension down and can develop a website which can solve this issues.

            Table of Contents

              First, What is Drupal? Drupal is one of the most popular and well developed open-source platforms in the world, and it is only getting growing larger, and from the huge community around the project there are some many modules that have been made and developed. And a drupal module is basically a collection of files containing some functionality and is written in PHP which adds a functions and feature to drupal itself not only in the back-end but also in the front-end. Without further ado we will tackle about some modules that can make your website more manageable and fun! Let’s dive into it!

              Animations (JS/CSS)

              Animations (JS/CSS) is one of the modules out there which very handy to use if you want to have a very playful website. It has a set of tool that is supported in many platforms. The great thing about this is just you just have to add your css classes in the animation configuration and ta-daaaaa you’re done. You can enjoy now a interactive and have a cool effects in just few clicks.

              Image Effects

              Why stick to plain images, when you can have some awesome effects and filters to your images! During the reign of Drupal 7 this module was called ImageCache Actions and transcended to Image Effects in Drupal 8: Image effects enables you to customize a add style and effects to your image and contains a set of actions that you can place to an image and set it up to suit your personal taste.

              Twig Tweak

              Looking for a module that makes theming easier? No worries, I got you! This theming module add functions and operations to make things faster/easier in complex twig template structures.

              Copy Prevention

              This module would be one of your favorite if you want your site contents can’t be easily copied.

              Some of its function is it:

              • Disable selecting of text.
              • Disable copying to clipboard.
              • Disable right-click function on all site content and many more.

              Field Group

              Better form navigation is a must to have a good user experience! This module helps you to organize fields into tabs, accordions, etc. just name it! This module have it.

              Reference:

              https://www.drupal.org/docs/7/creating-custom-modules/understanding-the-hook-system-for-drupal-modules

               

              Jessie Allen Anosa

              "Kumusta!". I call myself Jessie! A Filipino nomad raised in Philippines.

              Currently a Front-End Developer here in Acret-PH which is an awesome job that highlights my passion in designing and making things look good. Working here taught me a lot with the challenges and experience new things which helped me grow and continue to thrive to be better and do better, together with the support of the team and management it drives me to push myself to my limits and break my boundaries to be one of the person who will you can count and rely on.

              To sum it all, I'm in my happiest designing and making my living most from it :) — and trust me, I know things.

              How install Module Using Composer and Drush

              Modules
              How install Module Using Composer and Drush

              Table of Contents

                What is Composer ?
                  Composer is a tool for dependency management in PHP which requires PHP 5.3.2+ to run. Composer can be very usefull specially when youre module needs other dependency module or library.
                  Sometimes when the module is dependent to other modules and you manual install  in Drupal admin page ,Your module cannot be installed right away because it requires another module  for example. "Phpmailer". 
                  A developer might be having a hard time to figure it out and also waste of time just to install a single module when we don't use composer.
                  Composer is very handy to use and takes only 1 line of script . Ex. composer require drupal/phpmailer
                  Composer is a cross platform and make it run equally with macOS ,Windows and Linux . 
                  
                  What is Drush ?
                  Drush(Drupal shell) is a command line tool intended for Drupal CMS site building. Most pronounce Drush so that it rhymes with hush, rush, flush. See more details on Top 5 Useful commands from Drush 
                  Once you already install the module , it is not yet usable because you need to  enable it via Drupal Admin Page GUI or via Drush command 
                 Ex. drush en phpmailer

                Renier John Sediego

                Hello everyone and welcome to my Profile . My name is Renier and my life was started when I was born and raise not in Cebu but in Negros Island with simple life and living. I like solving problems where my knowledge capacity is hitting hard. I always do sports activities like bicycling , jogging and other physical activities to boost not only my immune system but also my mental state . I also love to hear party musics specially when i'm do coding stuff because I'm feel more focused and alive.

                Subscribe to