Contentify: Custom Theme / Modifying Default Theme

Created on 14 Oct 2018  路  15Comments  路  Source: Contentify/Contentify

Hello company.

I just put the update 2.5

Here is my problem:

I'm trying to create a contentify theme, for that I'm going to base myself on the morpheus theme
So I copy the MorpheusTheme folder to JopaTheme.

I modify the file: module.json

 {"slug": "Jopa Theme",
    "theme": true}

I modify the ModuleServiceProvider.php file

namespace App\Modules\JopaTheme\Providers; protected $namespace = 'JopaTheme';

and emptying all the caches, well I still do not see
the theme in the administration section -> website -> config -> theme

Would you have a solution?

and I notice something else too:
If I delete the phobos theme then the morpheus is selected
Well, I have a big mistake:

ErrorException
include(/var/www/html/contentify/vendor/composer/../../app/Modules/MorpheusTheme/Providers/ModuleServiceProvider.php): failed to open stream: No such file or
directory

question

Most helpful comment

For future reference for adding NEW/Edited themes:
After copying and renaming the files in the new "Module" (Theme)

Run this in the /contentify/ directory (f.ex: /var/www/contentify/)

You can run php artisan module:optimize. It will automatically regenerate module.json file in storage/app

Reference (Caffeinated/Modules)

Wiki Update(?):
This should perhaps be added to the Contentify/wiki/Themes page 馃憤

NOTE: from: Contentify/wiki/Enhancing-Contentify

This is the one and only rule to follow. Never touch vendor code!

^ Does this rule not apply in this case?

All 15 comments

/vendor/composer/autoload_classmap.php

and

/vendor/composer/autoload_static.php

search morpheus
and add the new theme

hello, thanks but it does not work

I added in /vendor/composer/autoload_static.php

'App\\Modules\\JopaTheme\\Providers\\ModuleServiceProvider' => __DIR__ . '/../..' . '/app/Modules/JopaTheme/Providers/ModuleServiceProvider.php',

i added in /vendor/composer/autoload_classmap.php
'App\\Modules\\JopaTheme\\Providers\\ModuleServiceProvider' => $baseDir . '/app/Modules/JopaTheme/Providers/ModuleServiceProvider.php',

right... one of json-file you must this theme add it too
in one of a .json file are all apps addet
good luck my friend
and good night :-)

yes
I managed to display the theme in the admin theme by adding this to in
contentify\storage\app\modules.json

"JopaTheme": { "basename": "JopaTheme", "slug": "Jopa Theme", "theme": true, "id": -1129226425, "enabled": true, "order": 9001 },

My question is how to find id value? "id": -1129226425,

I'm just waiting for an answer for the value of the id, that seems to be working for now.

Hello,

to be honstest, I do not not know the meaning of this ID. I guess this is just a unique random number.

The modules part of the CMS is provided by a third party library called "Caffeinated Modules". I have created an issue there and asked what the "id" property stands for so keep an eye on this issue: https://github.com/caffeinated/modules/issues/373

This comment may help: https://github.com/caffeinated/modules/issues/288

Thank you for the information, business to be continued.

Here is the answer:

Nothing in particular - it's just a unique ID value as an additional means of identifying modules within your application.

For future reference for adding NEW/Edited themes:
After copying and renaming the files in the new "Module" (Theme)

Run this in the /contentify/ directory (f.ex: /var/www/contentify/)

You can run php artisan module:optimize. It will automatically regenerate module.json file in storage/app

Reference (Caffeinated/Modules)

Wiki Update(?):
This should perhaps be added to the Contentify/wiki/Themes page 馃憤

NOTE: from: Contentify/wiki/Enhancing-Contentify

This is the one and only rule to follow. Never touch vendor code!

^ Does this rule not apply in this case?

  • Suggestion: change the name of this issue to: "Custom Themes or Modifying Default Themes" ?
    Was about to create a new issue before checking this one.

Hello,

Does this rule not apply in this case?

To which case do you refer? If you copy a theme, then the code is transfered to your authority and it's no longer considered vendor code (in this context). Because from the moment of the copy on, obviously you and only you are responsible for the code in your theme - you would not expect someone else to update or modify it, right? So this is not an exception of the rule, you just take some pieces of code out of the vendor domain and move them to your own domain. You can then do with this code whatever you want to.

But I want to emphasize that _the rule is only true for the upcoming version 3.0_. If you work with 2.6 I do not want to force you to follow this rule. v3.0 will have many changes that are supposed to make it easier to change/overwrite/extend Contentify code without touching it. v2.6 does not have these features yet.

This should perhaps be added to the Contentify/wiki/Themes page

Good idea, thanks.

Hello,

Does this rule not apply in this case?

To which case do you refer?

I was thinking of the part of editing
/vendor/composer/autoload_static.php
/vendor/composer/autoload_classmap.php
etc.

But, it's no big deal, since you're only adding your own theme there...

Ah okay, yeah these files are exceptions, because they are dynamically generated by the Composer tool. They are some sort of cache, in a way. So I would not call them "vendor code". They are not part of a repository. They might change whenever you use "composer requrie", "composer update" and so on.

Ah okay, yeah these files are exceptions, because they are dynamically generated by the Composer tool.

Ahhh!
But let's say I copy/paste + rename a Module.. (f.ex A theme in this case)
Can we not run Composer to create the lines for us? Instead of manually editing them?

I'm not too familiar with Laravel, Composer etc (yet), so it might sound stupid to ask about it...

There is already a console command from the library we use (Caffeinated) to create a new module: https://caffeinatedpackages.com/guide/packages/modules.html#creating-modules

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andakawa picture andakawa  路  4Comments

justtam picture justtam  路  6Comments

nrRudiak picture nrRudiak  路  3Comments

maxbrood picture maxbrood  路  5Comments

Ozymandias2 picture Ozymandias2  路  4Comments