Development

#2470 ([PATCH] sfSimpleCMS integration with sfMediaLibrary (new slot type))

You must first sign up to be able to contribute.

Ticket #2470 (new enhancement)

Opened 10 months ago

Last modified 5 months ago

[PATCH] sfSimpleCMS integration with sfMediaLibrary (new slot type)

Reported by: Rob.Sworder Assigned to: francois
Priority: minor Milestone:
Component: sfSimpleCMSPlugin Version: 1.0.0
Keywords: cms integration media images Cc:
Qualification: Unreviewed

Description

I've created a new slot type for the sfSimpleCMS to allow direct pulling of images from sfMediaLibrary into a slot (without being enclosed in a textarea). It requires one extra file (/plugins/sfSimpleCMSPlugin/lib/slotType/sfSimpleCMSSlotMediaLibrary.class.php), plus app.yml changes below (i.e. no diffs against any current files):

sfSimpleCMS:

slot_types:

MediaLibrary?: MediaLibrary?

Notes:

The slot type class is derived from the sfSimpleCMSSlotImage.class.php, but requires input_asset_tag() from sfMediaLibrary. 'form_name' also needed directly setting, as the default value of 'this.previousSibling.previousSibling.form.name' does not work in this context.

Attachments

sfSimpleCMSSlotMediaLibrary.class.php (2.9 kB) - added by Rob.Sworder on 10/28/07 14:47:14.
sfSimpleCMSSlotMediaLibrary.class.php--with-target (3.2 kB) - added by plan-r on 04/16/08 21:21:33.
enhanced version with "target" param for linked images

Change History

10/28/07 14:47:14 changed by Rob.Sworder

  • attachment sfSimpleCMSSlotMediaLibrary.class.php added.

(in reply to: ↑ description ; follow-up: ↓ 2 ) 11/16/07 10:10:39 changed by Serg.Sokolenko

I think it is not needed, because there is "List of components" slot type. So you just need to create yout component and include it into cms:

mediaLibrary:
  component: sfMediaLibrary/mediaLibrary

(in reply to: ↑ 1 ) 11/30/07 11:53:06 changed by Emiliano.Gabrielli

Replying to Serg.Sokolenko:

I think it is not needed, because there is "List of components" slot type. So you just need to create yout component and include it into cms: {{{ mediaLibrary: component: sfMediaLibrary/mediaLibrary }}}

I do not agree... tried both solutions and I think the new slot type is quite much more clean and simple to use.

Adding a component may work, but makes the editor obliged to be aware about the name of the component and the syntax to use it in the slot ...

I'm happily using the given patch, and I can sponsor its inclusion in the next plugin release for sure :)

(in reply to: ↑ description ) 04/16/08 21:20:01 changed by plan-r

Replying to Rob.Sworder:

Hi Rob, thanks for this helpful snippet.

I just made some changes to get a another form field in the slot-editor for adding a target to a linked image e.g. " target='_blank' ".

I just added 3 or 4 lines of code to the sfSimpleCMSSlotMediaLibrary.class.php. You can find the "enhanced" version of Robs slotType under "Attachmants" section of this page here, as file "sfSimpleCMSSlotMediaLibrary.class.php--with-target"

Download the file to the directory "../plugins/sfSimpleCMSPlugin/lib/slotType/" and rename it to "sfSimpleCMSSlotMediaLibrary.class.php" and follow the steps as described from Rob.

Cheers, Ralf.

04/16/08 21:21:33 changed by plan-r

  • attachment sfSimpleCMSSlotMediaLibrary.class.php--with-target added.

enhanced version with "target" param for linked images