I need to manipulate a content type (people) before being saved from ADMIN.
I need to save the name + surname in the title
I know the presave functions (hook_node_presave or hook_entity_presave) should be used.
My problem is where should these functions be written?
I am writing them in themes / custom / MYPROJECT / MYPROJECT.theme but they do not run
Where are the preset functions written for ADMIN to use instead of the normal ones?
You can put your hook in a .module file of a module. You should create a custom module for this, example below:
in modules/custom create a new folder {PROJECT_NAME}_general now referred to as MODULE_NAME) and add 2 files: {MODULE_NAME}.info.yml and {MODULE_NAME}.module
In the .info.yml file you just put some information regarding your custom module, for example:
name: Name of your module
type: module
description: Description of your custom module
core: 8.x
package: Custom
Now you can enable your module using either drush (drush en MODULE_NAME -y) or using "extend" from the admin menu.
Finally add your hook to the .module file and write the desired code.
You can also find all of this information here and here
Hope this helps you out!
Related
I am working with Bitrix24. I want to customise the component and module of Bitrix24.
But I didn't have the standard documentation for this.
Some one help me for the same,how we can work with local folder for customise component and module etc.
If you need to change logic of component you may do through this way:
create the local folder in your documet_root path
create components folder in the local folder
create bitrix folder in the components folder
copy component folder from /bitrix/components/bitrix to
/local/components/bitrix
edit logic in the component.php file (or in class.php file if
component using new bitrix core - D7) in the copied folder
If you need to change only the view, this is another way:
Instead of creating the /local/components/bitrix you have to
create /local/templates/.default/ folder
Copy there only the .default template of a needed component
Edit template.php file
With the second way, you also may change (or rich it) some data in final $arResult array provided for the template.php, just create result_modifier.php file in the template directory.
You can find this and other information in the free course Bitrix Framework, pay attention to this link, it will be very helpful
I am trying to separate my admin code from my public code, I want to create 2 different directories in my app folder and resources folder, 1 directory named backend which contains all my admin code and another named frontend which contains public related code.
Each directory will have their own separate controllers.
Basically something like this:
-App
--frontend
--backend
-resources
--views
---frontend
---backend.
If there is a better way to do this i would also like to know.
By default you composer.json is autoload all in app. So you can make the structure which you described above.
Frontend and backend separating usually used for Controllers, in this case you need to make a correct namespace.
With views you would'n have any porblems. Just make a correct path when you calling your views.
For example:
view(frontend/index); // you can use dot instead of /
Using django-cms 2.4 I need to create pages that contain bootstrap code, but the html5lib used cleans data-* attributes. No matter if you specify valid_element in TINYMCE_DEFAULT_CONFIG. (I still looking for a similar option for Wymeditor), because this is done in #plugins/text/models (clean_html function: https://github.com/divio/django-cms/issues/1529 )
Github issue:
https://github.com/divio/django-cms/issues/1529
What could it be a possible workaround?
How can I extend the text plugin in the admin part?
Thanks!
i belive the removing of the fields is done by html5lib that the cms uses as python package, you'll need to open html5lib folder and open sanitizer.py, in line 184 where the code is:
if name in self.allowed_attributes])
change to:
if name in self.allowed_attributes or re.match( r'data-.*',name)])
this will allow all data-(whatever) attributes
for WYMeditor the data-(whatever) attribute is already allowed
I have an custom module for search location.Now i want to put this module in to one of menu item content page. I am using joomla 2.5. Any way how to do it?
I have solve it by use the {loadposition} method
For using the module into your content page go to extension manager->plugin manager.Then search for Content - Load Modules plugin enable it(if disable). Then set style to no wrapping(raw output).
and then to your article manager and insert this line where you want to display your module
{loadposition myposition} //where myposition is the position of your module
I am developing a Magento extension and would like to run some jQuery script in the footer of the html template.
I have manually edited page.xml layout file to load my jQuery source and manually edited the footer.phtml template file to test my code, but I now want to package it up into an extension. The question is how to do this within my extension configuration, to tell magento to load the new jQuery source library in the header, and to append code somewhere in the footer (or anywhere) in the magento generated theme html.
Create a custom Magento Module
Use this module to add a customer Package Layout Update XML File
Use this Package Layout Update XML files to add a javascript src link to a (CDN?) jQuery, and add a custom block to the before_body_end block
Use this custom block to output your needed Javascript code
Use Magento Connect System->Magento Connect->Package Extensions to package up your customer Magento Module file, as well as any other files on the system you used (phtml template, jQuery files if not using a CDN, etc) into an Extension.
Wouldn't it be easier to use a static block? This way the client or yourself could update the jQuery right in the admin area without going into code. You could also add logic with multiple blocks if you needed. You can display a static block in a template like so:
<?php echo $this->getChildHtml('staticblockname') ?>
Otherwise you might want to read this tutorial on creating a module (which you call an extension): http://magento4u.wordpress.com/2009/06/08/create-new-module-helloworld-in-magento/