0

I've been looking around for several days now, maybe i'm just not fully understanding how the new Drupal 8 framework works entirely. What i'm trying to do is create a module that is a complete product that runs on the Drupal framework. I need to be able to completely customize the Drupal settings when the module installs. Changing things like the "Home" link to be "Dashboard" or just remove/disable it entirely or updating the front page url to point to the page i'm going to be creating programatically. There are also a myriad of administrative settings that i would like to set as well like the site email, error pages, email templates, and configuration of other required modules.

If anyone has any examples of how this can be done or can point me to the right areas of documentation that has the answers i'm looking for (googling has not yielded the answers and i like to think i have pretty decent google foo).

  • 1
    This question isn't specific enough, you won't get good answers that way. Menu links can be edited in Structure -> Menus. You can make a basic page from Content. You can change the default front page in Configuration -> Basic site settings. – RaisinBranCrunch Mar 28 '17 at 15:11
  • @RaisinBranCrunch Well i have a lot of settings i want to update but i'm not interested in where to change those specific settings (i already know that) i'm wondering how i programatically change these settings in my module. – Lindsay Mickey Apr 3 '17 at 18:00
  • Menu links and basic pages are content, not configuration, so it's a pain to include them in an installation profile or in a module, but you can create all of these in code if you need to, or you could use a module like default_content which allows you to export an entity with a drush command, and have it created on installation of your module. – RaisinBranCrunch Apr 3 '17 at 18:08
0

I think what you are thinking of is configuration and overriding configuration. You can load any config object and set its value.

See: https://drupal.stackexchange.com/a/187488/57

Menu links are entities and can be loaded and changed too. See: https://drupal.stackexchange.com/a/225605/57

  • I probably would avoid install profiles, which are one shots that happen during install. Hard to manage and hard to update. Loading and importing configuration seems like the way to go. Maybe not even in hook_install. Maybe shifting all the config files the module ships with into the config sync directory, and then informing the user to turn it on since that's a batch process. – mradcliffe Mar 28 '17 at 14:42
  • Yeah, I am not a fan of them either. I just don't know the scope of change they want to achieve. Some prefer as an installer, some as features, some as hook_install. – Kevin Mar 28 '17 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.