[Neos] Exporting Media image tags

Christian Loock brainshack at gmail.com
Fri Apr 25 15:42:49 CEST 2014


Hi,

maybe this can help.
This is a simple Aspect I wrote to overwrite the getRoles method in the
Account model of Flow's Security context. What you basically need to do is
to add an @Flow\Around annotation to your method. This will stop your
original method to do anything unless you tell it to. If you overwrite a
mehtod that returns something, your advice can just return a value that
will be returned instead:

/**
 *
 * This method determines the Roles of the User based an what is assigned
to him in the database and which
 * ClientLanguage Currently is selected
 * @Flow\Around("method(TYPO3\Flow\Security\Account->getRoles())")
 */
public function getRoles(\TYPO3\Flow\AOP\JoinPointInterface $joinPoint) {
            // Do Your stuff here and return a value like you would
actually be the called method
            return $newRoles;
        }


To access the original class, you can simply use $joinPoint->getProxy.
You dont need to do anymore then this, your advice will be called everytime
you pointcut expression is matched. No need to further bootstrap or
anything. Just make sure your aspect class has the @Flow\Aspect Annotation.

h2h





2014-04-25 15:14 GMT+02:00 nikos <nick at jamalade.com>:

> Hi Aske
>
> Wondering if there is any info I could look at for AOP to have a look at
> this. I have looked at the Flow documentation which seems ok but I dont get
> how this would get bootstrapped. I am probably missing something obvious !
>
> Any help would be appreciated
>
> Best wishes
>
> Nick
>
>
> On 04/04/2014 21:13, nikos wrote:
>
>> Hi Aske
>>
>> Thanks for the clarification I'll raise a feature request as you suggest.
>>
>> I think I fancy the idea of using AOP to add this feature, something I
>> haven't done as of yet. I get the concepts and as a start I would try using
>> the
>> around advice and replace the exportImageVariant and importImageVariant
>> of the SiteExportService and SiteImportService. Then refine as necessary.
>>
>> However what I am not sure of is how if I Implement the Aspect class in
>> my site package how does that get included when on the CLI I use  ./flow
>> typo3.neos:site:export and also how to get it used through the Neos
>> backend import. Any pointers to examples or ideas of how to start would be
>> appreciated. I have read the Flow documentation on AOP and although I
>> understand how to implement I cant figure out how the magic works hence my
>> question!
>>
>> Many thanks
>>
>> nikos
>>
>> On 04/04/2014 07:54, Aske Ertmann wrote:
>>
>>> Hey Nick
>>>
>>> Unfortunately not, the import/export is still quite basic. However you
>>> could do a normal database dump instead for now or use AOP to add the
>>> feature
>>> to the import/export services.
>>>
>>> In any case please submit a feature request on http://forge.typo3.org/if you don’t find any existing one.
>>>
>>> Thanks
>>>
>>> Best regards
>>> Aske
>>>
>>> On 03/04/2014, at 15.35, Nick <nick at jamalade.com> wrote:
>>>
>>>  Hi all
>>>>
>>>> I am wondering if there is a way of preserving the Media image tags
>>>> when exporting a site?
>>>> At the moment I am developing a the site on a dev machine and then
>>>> putting changes (content) up to a pre-production site via export. Every
>>>> time I
>>>> have to re-tag the images, as site export doen't preserve these,  which
>>>> is a bit (just tiny) frustrating so wondering if there is a better way that
>>>> someone may know.
>>>>
>>>> Many thanks
>>>>
>>>> nikos
>>>> _______________________________________________
>>>> Neos mailing list
>>>> Neos at lists.typo3.org
>>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/neos
>>>>
>>>
>>>
>>
> _______________________________________________
> Neos mailing list
> Neos at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/neos
>


More information about the Neos mailing list