Drupal 8: How to change content in block in a custom module - drupal-8

I have a requirement to change the content in the block using custom module. Appreciate if anyone can suggest some pointers, examples or already existing custom modules for this purpose. Thanks

Related

How to add php code in custom blocks in drupal 8

I have a drupal 8 fresh installation, I need to add some php code such as getting base url in custom blocks.
Please guide me in acheiving this.
Thanks.
PHP filter is a core module in Drupal 7 but in Drupal 8 it is removed because of some security reason.
You could and should do your PHP logic with template_preprocess_block. As creating a programmatic block just so you can use PHP is more work than necessary, overkill, for this use case.
Also, without any more specific info regarding make them dynamic based on base URL, this is as far as I can go.

django cms placeholder not in structure view

My co programmer developed a django plugin for use in a django project and on his setup, the plugin works. he can write a placeholder in the django template being used and load that with the custom plugin via the django-cms structure view. I tried doing the same thing but i noticed that the placeholder i put in the html in the same place he put it in isn't appearing in the structure view. the only placeholders appearing in the structure view and can be edited are static placeholders. placeholders entered like the ones in the django tutorial
http://docs.django-cms.org/en/release-3.3.x/introduction/templates_placeholders.html
and are placed with this code
{% placeholder "custom_name" %}
aren't appearing in the structure view. i couldn't find a similar scenario here in stackoverflow. I have a fairly similar setup to my co programmer too. i copied the same repo he's working on and i even used a dump from his postgres database in case there's something wrong with my own setup but still no luck. there are no DEBUG errors appearing in the console or the webpage so I am out of ideas. Has anyone encountered a similar situation? The django-cms we are using is version 3.1.0.
Thanks
I just found out earlier today what was wrong. I didn't notice immediately, that the page i was trying to edit was not a django-cms managed page which is why the placeholder wasn't working in it. In django-cms managed pages, the placeholder is working properly.
Thanks

File browser with Django and Alfresco

I have a Django site and a local install of Alfresco (community edition). One of my model contains a file reference which maps to a document in Alfresco. The view should have a field that spawns a file browser that can access the repository structure within Alfresco so that the user can pick whichever file they want at whichever version.
I looked at the CMSIlib module and it seems to be providing all the interaction I need for the back end code. Although downloading a document seems clunky.
There are lots of Django file browsers but none seem to interface with CMSIlib.
Do I have to code my own or have I missed something?
The version is Alfresco Community v5.0.0 (d r99759-b2) schema 8022 Spring Surf and Spring WebScripts - v5.0.0.
To be honest, I am not a python guy ! But I heard over the official #alfresco IRC channel that cmislib is not so much of an active project, and questions about it only bump once in a while .... The RESTful api however may be considered as a good alternative in your use case:
To access alfresco content using the RESTful api, you should be querying this webscript: /alfresco/d/<d|a>/<workspace>/<store>/<nodeId>/<filename>
where :
d and a refer to direct / attached mode
<workspace>, <store> and <nodeId> reference your content nodeRef
<filename> a file name of your choice
So you should be making a GET Request an a URL that looks something like this http://<host>:<port>/alfresco/d/d/workspace/SpacesStore/8444ad61-4734-40e3-b2d4-b8b1c81347fd/myFile.ext
Note : Depending on the permission set on your node, you might need to attach an alf_ticket to the URL for an authenticated alfresco user. Please check this for further insights.
UPDATE 1:
If you have a problem identifying your file nodeRef, then you can setup a repo webscript implementing your custom logic (browsing some folder / searching for a document by name or metadata ....)
If your are not familiar with webscript development check Jeff Pott's tutorial on the subject
UPDATE 2:
To get started with your webscript development check out Alfresco docs/wiki!
Check this wiki page to learn how to retrieve children for a given node !
Or check this wiki page to learn how to develop webscripts implementing your custom business logic.
If you do not have anything against the YUI javascript library (that is no longer actively maintained), you can integrate the object-finder already available in Alfresco Share. The library is in
share/components/object-finder/object-finder.js
You will need to modify it a bit given that you are not inside Share.
To be totally honest, I do not know if it is feasible because it has other dependencies but being a browser site library, in theory can be integrated everywhere.

Using Polymer Inside Django

I have a Django project already running with its UI created using Bootstrap and some custom CSS, JS.
Currently going through the Polymer Starter project, I want to do a UI makeover for my Django project using Polymer. Being a beginner with Polymer, my first question is, Is it feasible?
If yes, I would like to know from where should I start? I am not getting should I just remove all bootstrap and CSS already used and start replacing my old elements with newer Polymer elements? I have tried including Polymer elements in Django templates, but it doesn't seem to work this way.
I am just not getting the steps to follow for such a UI makeover.
Any piece of help will be greatly appreciated.
Refer to this https://groups.google.com/forum/?fromgroups=#!searchin/polymer-dev/django/polymer-dev/N2R8qknalOI/58ZhC1gWFh4J.
You should be able to wrap Polymer elements in Django templates. They are just static files. Just make sure you are using {% verbatim %} tags to wrap around your polymer elements.
However, if you are going for a complete UI makeover, use AJAX calls to the REST services running in the background on Django. Or if you do not want to use django-rest-framework or tastypie or something new, you can slightly modify your existing view functions to serve JSON that packs all the data you need for a dynamic page.

Magento how to make my own admin based custom template?

I am newbie to the magento. I want to develop my own custom template in magento. Where I would like to have some custom settings from admin panel to change the looks of the theme like change colour or to upload logo etc.. So can someone kindly tell me is there any documentation available or any referenced link? Any help and suggestions will be really appreciable.
Have a look at this link http://www.silksoftware.com/magento-module-creator
Near the bottom you have the Magento System Configuration section, with this you can create a module to handle all your admin settings for your entire site. This is by far the best way to learn how to setup modules, especially complicated ones that involve admin settings.
There will however be plugins for what you want so check on Magento connect first, and there are some free themes for older Magento installs that include similar custom plugins for customizing the themes you can use as a potential reference if you can dig them up (sorry I don't have any examples to hand as I used bought themes to learn from).