partial templates loading customization via custom sfView child - symfony-1.4

I have sf1.4 setup with my own custom sfPHPView and sfPartialView classes which does some extra things about loading template files in case of missing templates (falling back to default templates ...)
I have it activated via this view Classes definition:
APP_ROOT/config/module.yml
all:
enabled: true
view_class: MyProjectName
partial_view_class: MyProjectName
Problem
Everythings is fine untill I try to load partial from other module.
In that case sfConfig::get() returns only values loaded for current action module, so PartialHelper and its get_partial() cannot find my wanted view classes.
To be concrete it tryes to find that config variable in mod_partialmodulename_partial_view_class, but it has loaded only action module configs.
Does exists some common recipe which allows to have these "other module" configs loaded too?

Related

Is there a way to move Symfony 6's controllers to several other directories?

I'm starting to develop a project that will be quite big (hear lots of files) and I want to have an organization that's different from Symfony's default one: instead of having one dir for all my controllers, another for all my forms, etc, I want to have one dir per functionality, ie a directory for my homepage which will contain the controller, the templates, another dir for the blog page with the controller, forms and templates, and so on.
I tried what was explained in this (old) answer, and it didn't work : my routes weren't recognized, and a php bin/console debug:router showed they weren't listed anymore.
I feel I will have something to adapt in my routes.yaml file, which looks like this for now, and which explains why it doesn't work because it explicitely searches in the src\Controller directory:
controllers:
resource:
path: ../src/Controller/
namespace: App\Controller
type: attribute
I looked in the documentation I found, but I didn't find anything useful (I think I will have to remove the path and change it to something else, but I don't know what yet.
The above solutions are only for differentiating controller and template files. But For Entity, Events, and Forms it will not work.
It seems like you want to separate files for each module or functionality. For example, settings.yaml, controller, entity, forms, events, etc...
For that Symfony provides a Bundle feature. You can create a new Bundle in Symfony and use it as a separate feature. For more details please read this link

Typo3 extension configuration

I have installed typo3 extension "cookieman". The documentation says it comes with 2 static templates. Include the static TypoScript “Cookieman” in your root template or reference the necessary files in your site package. what is the location of a root template? and what is the syntax to include something?
first: be clear what Template means in this context.
there are multiple kinds of template in TYPO3.
There are HTML-templates which define the structure of parts of the output. That could be Fluid-templates or the older marker-based templates.
Then there are records which contain the typoscript configuration which also are called templates.
This typoscript-templates are meant. As the typoscript templates can be stored in each page of your page tree, which are concatenated, you have a root-template propably in the root-page of your website. (the added ts-template are called extension-templatesas they extend the basic configuration).
These records have a field for additional templates from TYPO3 extensions which are called static templates as they come from an extension and are never changed (never change any file from an extension inside the extension folders!!! you always can override the values).
Otherwise you can use explicit include statements in a typoscript configuration. The include statement was invented in TYPO3 4.6 and has changed it's syntax slightly until now. In the online-manual you can select your version to see syntax of your TYPO3 version.

Fields that are imported via config are disabled by default. How to enable them?

In a custom module for Drupal 8 I'm able to add a new content type with all of its fields, but all of the fields are disabled by default. How do I enable them during install of my module?
Edit To be clear, module fields are not being enabled by default under Manage Form Display. How do I enable (or disable) fields using something like hook install?
Edit 2 Along with enabling fields by default in a newly created content type, installing this module also updates fields on an existing content type (Article) and those fields are also disabled.
Edit 3 disabled meaning they are shown as disabled on the form display for the content type and users cannot see the fields when adding content.
There must be code that I can run via hook_install that enabled fields on a content type?
I'm presuming that by "disabled" you mean that the fields aren't displayed when an instance of your content type is made.
Personally I've been using the UI to set up how each of my fields are displayed through the "Manage Display" page provided for each content type. I drag the fields that I want to enable from the disabled section as you would normally.
When I'm happy with how the fields are arranged I then use the brilliant inbuilt export functionality (think features in Drupal 7 but way better) to generate the .yml config files for my content type.
This process is described brilliantly by this article on the Drupal website. In this case, as it's just the config for which fields that we want to display, it should be as simple as exporting the "Entity View Display" config for the content type to a .yml file. (note that you need to name your yml files correctly, this is explained in the article (and I think that the export module provides the auto-generated name anyway)).
Here is what the export looks like for one of my content types:
Once I've generated the config files that I want to apply to Drupal when the module is enabled it really is as simple as making two directories in the root directory of the module:
"./config/install"
and placing the config files into the install directory.
Now, when the module is first installed Drupal will apply the configuration provided by the files in the /config/install directory.
This process is elaborated upon here: https://www.drupal.org/docs/8/creating-custom-modules/include-default-configuration-in-your-drupal-8-module
When you export a field you have to export too:
"Field declaration" field.field.[entity_type].[bundle].[field_name].yml file. Don't forget to add re-used fields declaration
"Field Storage" field.storage.[entity_type].[field_name].yml file
"Form Display" where you have modified the field configuration. core.entity_form_display.[entity_type].[budle].default.yml
"Manage Display" where you have modified the field configuration. core.entity_view_display.[entity_type].[budle].[view_mode_id].yml files (If you have Default, Teaser, etc)
"Entity", if the entity is new. [entity_type].[type|paragraph_type|vocabulary].[bundle].yml file
I recommend you to use "drush cex/cim" commands to import and export configuration.
I don't know too much about Drupal 8 but when i try to create custom content type to use this article.
https://www.drupal.org/docs/8/api/entity-api/creating-a-custom-content-type-in-drupal-8
Then when i enable our custom module then content type is created successfully and the content type fields are also enabled.
Also i have try to create a node in this content type then the node is successfully created.
So please check this article.
It may be helpful for you.
Thanks,

Use bundle error templates in Symfony 3 app

I have a MyBundle bundle which I use in many Symfony applications.
This bundle provides common things which are shared across these applications, such as Controllers, Entities, templates, etc.
I would like the bundle to provide error templates as well.
I tried to put the templates in MyBundle/Resources/TwigBundle/views/Exception folder but the application does not use them.
When I copy TwigBundle folder from MyBundle/Resources into app/Resources then the templates are used as expected. However I do not want to copy the templates into every application's app/Resources folder.
Is it possible to override error templates using MyBundle/Resources instead of app/Resources?
TwigBundle always by default checks directory app/Resources/TwigBundle/views/Exception/ for templates.
If you want to use custom directory you have to override ExceptionController.
You can do this in config
// app/config/config.yml
twig:
exception_controller: MyBundle:Exception:showException
Default Twig ExceptionController can be found here.
Documentation

Is it possible to extend an Alfresco 5 web-script for the post method?

I'm trying to add some extra functionality to the site creation form of Alfresco 5 by creating a web script. I'm creating a jar file containing the module extension.
I have successfully modified the actual site creation for by adding a new site type (this was done for testing purposes only). I did this by adding the following to the extension-module.xml file:
<module>
<id>Create Site Extension</id>
<version>1.0</version>
<customizations>
<customization>
<targetPackageRoot>org.alfresco.modules</targetPackageRoot>
<sourcePackageRoot>create-site</sourcePackageRoot>
</customization>
</customizations>
</module>
/config/alfresco/web-scripts/create-site.get.js
model.sitePresets.push({
id: "site-test",
name: "TEST"
});
When added to tomcat/webapps/share/WEB-INF/lib and activated through the Alfresco module management page it works perfectly. I can see TEST in the list of site types.
I'm trying to do the exact same type of thing but with create-site.post.json.js. No matter what I do, I can't get my create-site.post.json.js web-script to fire. Is it possible to extend the .post.json.js file for create-site?
UPDATE
In case anyone wants to look at the raw source, here it is: Module Srouce
Everything in the module works correctly except for the create-site.post.json.js. I know for a fact that the deleteDashboard method inside the .post.json.js file works correctly and it's what I've been using to attempt to debug the script (in case the debugger was running it but not breaking into it for some reason. If it runs, it should delete the test site "good-site"'s dashboard so if it worked, the dashboard will be empty/nonexistent.
The issue is obvious. Because you are using extension module and overriding out of box webscript. Now if you change the type of webscript from get to post it will not override it. So, if you really want to replace out of box webscript with yours then you need to get to the point where this component is called and override that. You will also require to create full post webscript (all related files)

Resources