Hello,
I'm completely new to Elgg and I'm trying to figure out where I can find what in the Elgg installation and how to change things to my liking. It seems very complex to me. Then again I'm a total noob, so you might find my issue stupid.
I want to make a couple of changes to the layout / design of the site through an individual plugin that overrides the core or plugin files. If I understand correctly, that's the preferred method.
Unfortunately, it's unclear to me how find the right files to replace. So I was wondering if someone could help me get a better idea of the elgg-structure with a specific example:
In the "add" and "edit" functions for the "blog" and "pages" plugins, there is a field called "Upload a new header". I don't want customized headers on my site, so I would like to hide (or delete?) this field from the page view of "add/edit blog" and "add/edit page" function.
But I don't find the place to do that. There are so many different PHP files in the plugin directories and they all are somehow connected. I read the documentation about entities and views, but I don't understand where to find either the entity or the view in question, so that I can update it. There are e.g. add.php and edit.php files in different folders like elements, resources etc.
On top of that, the "how" is unclear to me. When I check my site with the inspector in my browser, it shows the generated HTML code. I don't understand how/where this is generated though. There are CSS files everywhere in the elgg-structure. Which one regulates what? For my example: In the "add post" page, there are two buttons: "Save" and "Preview". While the colours of those buttons can be defined in the settings, how could I e.g. move the "Preview" button to the same line as the "Save" button? Right now, they are unevenly placed. Where does Elgg get the information from where to position the "Preview" button?
I hope you can understand what I mean. I assume that these are total noob questions, but as I wrote, I am a total noob with Elgg. ;) Any help is appreciated, thank you.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
Welcome to Elgg.
There is no option or button to remove this field.
For this reason, you need to use a custom plugin to alter the view of the add/edit blog form.
You can use this skeleton plugin.
We will use override method to alter the views.
Copy this file:
To this folder:
Open this file and remove this code:
Thanks a lot for your help! Much appreciated. :)
It worked like a charm, and now I have an understanding of how to alter views. Now I just have to always find the right pages to alter. ;)
Bonus question: Would it be possible to add CSS code into such a view? Example:
Sure.
Just edit this code on:
If you continue to use this plugin then there is this file
\mod\my_plugin\views\default\my_plugin\style.css
Add your custom CSS style my_class to this file (I hope you know CSS: you can use SCSS too).
Use Developer tools aka Inspector in your browser to make your CSS style better.
Run 'Upgrade' via 'Administration' after saving changes to clean the caches.
Learn more.
I was wrong but I'll leave the previous reply to understand how to change CSS styles.
Well.
Your example will only change the header editing area, but not the blog preview with the header.
If so:
Add this class to \mod\my_plugin\views\default\my_plugin\style.css
Use Developer tools aka Inspector in your browser to make your CSS style better.
Run 'Upgrade' via 'Administration' after saving changes to clean the caches.
Hello again,
with the help of the above tips, I'm currently learning step by step how to change different parts of the site according to my wishes.
Today I stumbled upon a situation where I would need some help again. Maybe someone reads this and has an idea about how to do this:
I want to hide the "filter menu" for certain plugins, e.g. the "blog".
After reading the documentation about "menus", I found views/default/navigation/filter.php in the Elgg folder, copied it to myplugin/views/default/navigation/filter.php, and hid the menu successfully. However, it was then hidden for all plugins (as I expected).
So I moved the file to myplugin/views/default/navigation/blog/filter.php, hoping that it would then hide the filter menu only from the blog plugin. But nothing happened (I cleaned the cache and upgraded).
Is this the wrong folder? If yes, what would be the correct folder?
If it is not possible, because there is no "navigation" folder in the "blog" plugin, how could I hide the filter menu manually from e.g. resources/blog/all.php? I don't find any mention for the menu in this file. I found the "add" button, the "breadcrumb" menu and the "blog listings" and was able to manually change them, e.g. hide. But no "filter menu". That's why I thought that it maybe comes directly from the "filter.php" and did what I wrote above.
Thanks for any ideas about the matter.
Indeed, the easiest way is an overriding views.
But you should override these files:
Just copy them to your custom plugin:
Then edit them by deleting all 'filter_value' parameters in elgg_view_page() and add
Done!
Advanced way is a custom class (look at core) or event (read this - section register, menu:filter:<filter_id>)
But I think it's too early for you to move to that level ;)
Thank you once again for your reply. Much appreciated. I was able to hide the filter menu with the "easy" method. I will also try out to not just delete the values, but change them, so that I can use the filter menu.
My site looks and works now pretty much like I hoped. The trickiest part maybe is finding out where to find what in the code. If I can't find something, I can't edit it. That leads me to my (hopefully) last question for this thread:
On the "item" pages themselves (e.g. a created blog, page or event) there appear some new buttons at the top. On a "page", for example, logged-in users get these buttons:
"Add sub-page:" This button is found in the "view.php" file and I was able to make it show only for the owner of the page instead of all logged-in users.
"Subscribe": I can't find the code for this button in the plugin files. Where is it generated? And can it be hidden, either within a plugin or generally on the whole site?
"Edit": I can't find the code for this button either. Where is it generated? I want it to be shown also just to the page owner instead of all logged-in users.
Thanks in advance for any possible help.
User can select "Private" "Write access" level when creating a page.
In this case, only the owner will be able to edit page or create subpages.
You can remove this option, leaving only the private write access level.
But in this case, I don't understand why you need this plugin if you have blogs because Pages plugin like as wiki?
However, you can do it.
In elgg-plugin.php of your custom plugin add this code before ];
In elgg-plugin.php of your custom plugin add this code before ];
Tip: Use 'Developer tools' plugin then Develop -> Inspect -> Events/Views etc to find out some items and files on Elgg
Also, learn more about elgg-plugin.php structure
- Previous
- 1
- 2
- Next
You must log in to post replies.