texts: Enabling a custom richcombo plugin to CKEditor

texts:
I'm trying to enable my custom CKEditor plugin in Drupal, but the custom dropdown is never shown.

I'm using CKEditor module.

Here's what I did:

I created a new folder in /ckeditor/plugins and saved my code in plugin.js file.
The plugin became visible under "Editor appearance". I enabled it in /admin/config/content/ckeditor/edit/%my_profile.
The plugin file is loaded, but the init method is never invoked and my dropdown is never added to the toolbar.

Here is the code of my plugin:

(function() {
  console.log('custom_richcombo plugin.js loaded');
  CKEDITOR.plugins.add('custom_richcombo', {
    requires: ['richcombo'],
    init: function(editor) {
      console.log('custom_richcombo plugin initialized');
      var config = editor.config;
      editor.ui.addRichCombo('editorLinksCombo', {
        label: 'Custom dropdown',
        title: 'Custom dropdown title',
        multiSelect: false,
        init: function() {
          this.startGroup('Test group');
          this.add(1, 'Option 1', 'Title for option 1');
          this.add(2, 'Option 2', 'Title for option 2');
          this.add(3, 'Option 3', 'Title for option 3');
        },
        onClick: function(optionID) {
          console.log('Clicked on option', optionID);
        },
      });
    }
  });
})();

This works perfectly fine on a standalone CKEditor installation.

Can someone please point me in the right direction?


texts: How do I create custom webform reference settings?

texts:
I have a Content type, in which there is a field of type Webform Reference.
I want to have a custom setting (a checkbox) in Webform (Webform Add Page), which should also appear in Content type under Webform Reference settings.
Also how can I get that setting value in Node context?


texts: Druapl show unserialize() error after restore database

texts:
The Drupal version is 7.34

Database is PostgreSQL 9.3.3

PHP is 5.4.39

Testing restore database at shared web hosting (restore the whole database after delete it)

No error if I just restore the records (empty all the tables records)

Show below error after restore database

  Notice: unserialize(): Error at offset 0 of 13 bytes in variable_initialize() (line 936 of /home/www/mywebsite.me/includes/bootstrap.inc).

There're more error like the above line, I just skip them for brevity. These error all related to the table with a field that has bytea type.

I also have a development environment built up by myself. No such error occur. Although the PostgreSQL and PHP version is different to what the shared web hosting provided to me. Development environment PostgreSQL is 9.3.5


texts: How to use contextual filter argument as a title in default menu tab -- views?

texts:
How to set title in above image = current year so that it will provide all titles/content of current year -- 2016?

OR

How can we create an yearly archive with default year opened = current year using views?
Step 1 I followed:

Created a view of type page:

@edit contextual filter applied: ----- step: 2

I have attached preview of view that is being rendered. If you notice in first snapshot, there is coming a list of years

2016  2015  2014   2013

What I'm trying to achieve is make 2016 default so that when I visit path /data-title-document it will actually open data-title-document/2016.

Hope you understand.


texts: "Drupal is initializing" rule firing multiple times

texts:
I am using the Rules module and the event "Drupal is initializing" in a rule to check if a user has clicked their confirmation link in their email that Drupal has sent them to verify their account. This rule is called with every page load several times.

Should this be?
And Is there a way to accomplish this without the need for firing this rule?


texts:
How do I add an edit button on each row of a "tableselect" form element?

The code I have is the following one.

function example_elements_form() {
    $form = array();
    $header = array(
        'title' => array('field' => 'n.title', 'data' => t('Title')),
        'author' => array('field' => 'u.name', 'data' => t('Author')),
    );
    $query = "SELECT n.nid, n.title, u.name FROM {node} n INNER JOIN {users} u ON n.uid = u.uid". tablesort_sql($header);
    $result = pager_query(db_rewrite_sql($query));
    while($partial_node = db_fetch_object($result)) {
        $options[$partial_node->nid] = array(
            'title' => check_plain($partial_node->title),
            'author' => theme('username', $partial_node),
        );
    }
    if (!empty($options)) {
        $form['nodes'] = array(
            '#type' => 'tableselect',
            '#header' => $header,
            '#options' => $options,
        );
        $form['pager'] = array('#value' => theme('pager'));
        $form['submit'] = array(
            '#type' => 'submit',
            '#value' => t('Submit'),
        );
    }
    return $form;
}


texts: Would be creating menus totally in views reasonable?

texts:
Above question is about two situations:

Standard, simple menu with 1-2 levels of depth,
Catalog on commerce site, with number of products, next to every item (taxonomy term) of menu.

I can imagine, that counting all nodes related to every taxonomy term every time when site is accessed would kill the server (if there is like hundreds of products), but views have some cache option, don't they? Can they cache their output and make menus views driven reasonable?


texts: How to prevent closing CTools modal window with ESC during AJAX?

texts: How can I prevent closing CTools modal window with ESC key during AJAX request?


texts: Drupal 7 Search Redirect (similar to the old AOL keyword search)

texts:
I've searched around for any pre-existing solutions to tackle this problem but so far nothing obvious. Here is basically what I'm after:

1) User enters keyword(s) via core search box

2) If user enters a specific keyword from a list of pre-determined keywords, redirect them immediately to a specific URL/node, e.g:

switch ($keyword) {
    case 'brand a':
        drupal_goto('brands/brand-a');
        break;
    case 'brand b':
        drupal_goto('brands/brand-b');
        break;
    default:
       do a regular keyword search . . .
       break;
endswitch;

3) If their keyword doesn't exist in the pre-determined list, shuffle them off to the standard Drupal search

Any ideas on how to best accomplish in Drupal 7?


texts:
I am trying to create a dynamic event subscription, for drupal8 commerce order state.

My use case is the following.
I want to create an invoice for any order which goes into state e.g. PENDING. There is a custom state/transition yml which i have created.

Which state transition should trigger an invoice creation, i want to make this configurable.

So, the admin should be able to select specific states, in a custom settings form, and the system should only create invoices when an order enters to one of these states.

I need to create an event subscriber, which is dynamic according to the settings that the admin has entered.

In terms of code, in the event subscriber, i have the following code

public static function getSubscribedEvents() {
  $events = ['commerce_order.place.post_transition' =>'onTriggerInvoiceCreation'];
  return $events;
}

public function onTriggerInvoiceCreation(WorkflowTransitionEvent $event) {
  $invoice_creation_states = explode(",", $this->config_factory->get("my_custom_module.settings")->get("invoice_creation_states"));
  $current_state = $event->getToState()->getId();

  if(in_array($current_state, $invoice_creation_states)) {
    //create the invoice
  }
}

So, a far as i understand, i need to do one of the following

In function getSubscribedEvents, i read the my_module.settings from configuration and find a way to construct the correct event subscriber.
So, instead of

$events = ['commerce_order.place.post_transition' =>'onTriggerInvoiceCreation'];

i should do something like the following

$invoice_creation_states = explode(",", $this->config_factory->get("my_custom_module.settings")->get("invoice_creation_states"));
for($i=0;$i<count($invoice_creation_states);$i++{
  $events = ['commerce_order.'.$invoice_creation_states[$i].'.post_transition' =>'onTriggerInvoiceCreation'];

As this function is static, i don't seem to be able to get hold of the config service in order to get the $invoice_creation_states.

So next thought is to create a more generic event listener, for all order state changes, and in the corresponding listener callback e.g. onTriggerInvoiceCreation i could get the custom settings and make the above condition in order to execute or not the invoice creation code.

Question: Is there a more generic transition event than
commerce_order.TRANSITION_ID.TRANSITION_PHASE

something like

commerce_order.ANY_TRANSITION.ANY_PHASE ?


texts: Transfer Value of Field to Another Field under Content Type Manage Fields

texts:
I have created several content types and unfortunately, I made a mistake on some of the fields. The fields are field_image and field_screenshot.

Under manage fields, I use field_image and sometimes field_screenshot. Now I want to use one field only for featured image on my node content. So, how can I transfer the value of field_image to field_screenshot? Is this possible?


texts: Is it possible to control permissions relating to flags more closely, either in flag.module or by installing another module? I'd like to be able to control permissions for each flag, such as "Flag content with this flag", "unflag content with this flag", "view this flag" etc etc.


texts: How do I remove variables from the variable table when my module uninstalls?

texts: I'm working on a Drupal 6 module that adds some variables to the variable table. How can I go about having those variables removed from the variable table when the module is uninstalled?


texts: Hide Pages from Page Manager for certain user roles

texts:
We're using panels with page manager and want to restrict access to pages based on user roles and/or language.

In a nutshell we will have many home pages for various regions. Each home page will be its own page in page manager. Variants will not be used. The admin of one region should only see the pages referring to their region, but I can't seem to find a way to limit what can be seen in the page manager list on /admin/structure/page_manager we've looked into the code of the pagemanager_ui module but we can't see any way to hook into it. We saw that PageListBuilder.php seems to generate the table on that page but I'm not sure of a hook we can use to check for permissions line by line of the pages it's building the rows for.

I suppose in this function

  public function buildRow(EntityInterface $entity) {
    /** @var \Drupal\page_manager\PageInterface $entity */
    $row['label'] = $entity->label();
    $row['id'] = $entity->id();
    $row['path'] = $this->getPath($entity);

    return $row + parent::buildRow($entity);
  }

we could rewrite it to check for permissions before adding the row. But I'm not sure if it's a good idea to rewrite core code like that. Also if I wrote a patch it seems like this would be too specific.

Is there a way to limit the pages that a user sees in /admin/structure/page_manager based on their roles/permissions?

UPDATE: If we were to make a new PageListBuilder class in our custom module, how would we get it to overwrite the default class and use our own instead?


texts: How do I add a date field that can be filtered by a relative value?

texts:
If I create a view, I can add a filter that filters on a relative value on some built-in date field, such as Post date.  For instance, the screenshot below shows a filter I've created that will show articles posted in the last four days.

Unfortunately, there is no date field type in core.  To get a date field type, you can install the Date module.  This allows you to create nice widgets for inputting dates.  However, I've found no way to filter the date fields created by the date module by a relative value (like the filter shown above for Post date).  There are Is equal to and Is not equal to operators, but no greater than operator, in the "Configure filter criterion" screen.

I believe that this should be possible, as is also evident from Nigel Waters's upvoted answer to this question: view to show content with future date. However, the exact steps one must take to reproduce the result shown in the upvoted answer eludes me.


texts: How to use Paragraph components inside of Paragraph components

texts:
I have a component-based system using Paragraphs. I create the markup in Twig (Drupal 8), then pass the values of Paragraph fields to the component's properties. So for a super basic example:

{# card.html.twig #}

<div class="card">
    {% block content %}{% endblock %}
</div>

{# paragraph--card.html.twig #}

{% embed "card.html.twig" %}
    {% block content %}
        {{ content.field_content }}
    {% endfor %}
{% endembed %}

Then let's say in my Paragraph Type "Card", I have a field "Content" of type "Text (plain)". Pretty standard stuff.

Problem

But, what if I wanted to use another Paragraphs-managed component inside the content block? For example, what if I wanted to put a Button component inside the Card's content, where the button's text and action are determined by a Paragraphs field?

What I've tried

My first thought was to say, okay, if a Card is capable of having a Button, put optional Button fields in the Card Paragraph type, then in Twig, conditionally include the Button component file, and set its properties to the added Card Paragraph fields.

The problem with that...

But for one thing, this isn't very DRY. What if my Button component later changes its API/properties? I'd have to go update the Button Paragraph type, and the Card Paragraph type.

Furthermore, it's just not very flexible. I'm now essentially hardcoding Button support inside my Card component and Paragraph type, when ideally the component system would be flexible to put whatever other component you wanted inside the Card, in any order, without having to fiddle with the Twig files and add new fields to the Card Paragraph type.

To further illustrate the problem...

Another prime example of this functionality would be for a Tabber component. Inside each tab panel, I'd want to give my content editors the option of adding literally anything inside the panel—buttons, forms, cards, media objects, videos, etc.—in any order. How would I go about making this component and Paragraph type such that the content for each panel could use other components and Paragraphs?

What I've researched

I figured that for sure someone would have run into this issue with a Tabs component. From some Googling, apparently not really. Most of the examples of Tab components I've seen only accept plain text or markup for the panel content.

It seems to me I'd have to create a custom module and dig into the PHP side of things. I'd rather not go down this route, and preferably don't want to have to use modules at all if Twig + Paragraphs is powerful enough to do what I want.

Sorry if this is a bit long-winded. Also apologies in advanced if this is something simple and I'm overcomplicating it; I'm fairly new to Drupal.


texts: Creating 2 forms to work together on the same page for the same query

texts:
I'm facing trouble coming up with the following approach:

I will have 3 separate forms acting on the same query from third party API's.

On the front page there is a shorter quick-form that would lead to the page of the other 2 forms. In some cases the information from the first form is sufficient to query the information and the information will be queried.

In other cases additional input from the second form is required to make the query. The third form is for fine-tuning an existing query.

The first form isn't an issue, it's a separate block on the front page that will store the information internally for the second form to see with multiform functionalities and on submit redirect to the second forms page, where the form can process the information and see if a query can be made or will give results and go ahead with it, if not, then ask for further input.

The second and third form are on the same page, where the second form has necessary input fields for the query, which can also be changed to change the results, and the third form is just for fine-tuning this query like a filter or so.

Right now I'm stuck with the second 2 forms working together on the same page, being separate forms but altering the same query/information. And would appreciate all and any help with this approach that would be "the Drupal way".

Better visualization:

Imagine a flight booking site: first form is your departure airport that takes you to the second 2 forms, where already a lot of flights from your airport can be displayed, second form takes in a destination, dates and passengers; the third form would let you fine-tune travel class, meals, airlines to avoid airlines preferred, how many layovers, how long layovers and so on..

All the information with each form is queried from different airline API's and will have to be redone on every change.


texts: SQL View of Collection Field taking a long time to complete

texts:
I have a View which would count the number of items related to a Taxonomy term.
The view counts Field Collections, and inside each field collection there is one or more taxonomy terms. I have a contextual filter by taxonomy ID. The SQL is taking almost a second to retrieve a few hundred items (just the COUNT) from a 6,000 items database. Obviously, there is something wrong, with those figures it presumably should take no more than a hundredth of second. Where is the bottleneck in performance? The following SQL is adapted from Views GUI, slightly retyped to accomodate to phpMyAdmin and the SQL_NO_CACHE option added to check for time performance.

 SELECT SQL_NO_CACHE COUNT(DISTINCT field_oem_ubicacion_field_collection_item__field_data_field_field_rf_producto.field_field_rf_producto_value) AS field_oem_ubicacion_field_collection_item__field_data_field_,
  COUNT(DISTINCT field_oem_ubicacion_field_collection_item__field_data_field_field_rf_producto.delta) AS field_oem_ubicacion_field_collection_item__field_data_field__1,
  COUNT(DISTINCT field_oem_ubicacion_field_collection_item__field_data_field_field_rf_producto.language) AS field_oem_ubicacion_field_collection_item__field_data_field__2,
 COUNT(DISTINCT field_oem_ubicacion_field_collection_item__field_data_field_field_rf_producto.bundle) AS field_oem_ubicacion_field_collection_item__field_data_field__3,
 COUNT(DISTINCT field_oem_ubicacion_field_collection_item__field_data_field_field_rf_producto.field_field_rf_producto_format) AS field_oem_ubicacion_field_collection_item__field_data_field__4
FROM
 field_collection_item AS field_collection_item
     LEFT JOIN field_data_field_oem_ubicacion AS
 field_data_field_oem_ubicacion ON field_collection_item.item_id =
 field_data_field_oem_ubicacion.field_oem_ubicacion_value
  LEFT JOIN node AS  field_oem_ubicacion_field_collection_item ON
 field_data_field_oem_ubicacion.entity_id =
 field_oem_ubicacion_field_collection_item.nid
     LEFT JOIN field_data_field_familia AS field_data_field_familia ON
 field_collection_item.item_id = field_data_field_familia.entity_id AND
 field_data_field_familia.entity_type = 'field_collection_item'
     LEFT JOIN field_data_field_field_rf_producto AS
field_oem_ubicacion_field_collection_item__field_data_field_field_rf_producto    ON
field_oem_ubicacion_field_collection_item.nid =
field_oem_ubicacion_field_collection_item__field_data_field_field_rf_producto.entity_id
 AND field_oem_ubicacion_field_collection_item__field_data_field_field_rf_producto.entity_type = 'node'
 WHERE
  (( (field_data_field_familia.field_familia_tid = '257738' ) ))
 LIMIT 1 OFFSET 0


texts: How would a customer be able to get free shipping when there are no free shipping options?

texts:
We just launched our ecommerce store using Drupal Commerce Kickstart, which heavily uses Rules to manage shipping.

We have had two orders from the same Virginia-based customer. Both orders were processed without shipping applied. When I select the same items, enter the same Virginia USA shipping address and go through the checkout process, I get the expected behavior of Standard Shipping - $15 being applied. I cannot replicate the behavior.

The checkout process / sequence is as follows.

The "Standard Shipping - Domestic" rule is called for:

Addresses within the "US"
Orders not contain three Product Categories (bikes, wheels, forks)

*The order in question does not contain these items.

I attempted to duplicate in both Chrome Incognito & Firefox. No issues on my side. I see the following:

One option to select from under "Shipping"

Shipping applied under "Review Order"

When viewing in admin mode, I see shipping applied as a line item on the order.

PLUS - The correct sequence is maintained

When I view the customer order, there is no shipping line item.

AND the customer appears to be going through a different order sequence and bypasses the Shipping selection. How is this possible? I am totally confused.

How is it possible to bypass the checkout sequence in Commerce Kickstart?
1. Test: Checkout > Shipping > Review Order
2. User: Create order > Add item to cart > Pending (Which is typically after the order is fully paid. We have confirmed that payment has been received.)

Very curious. Curiouser & curiouser.


texts: Bulk upload via Form API, or, Please Warn Me

texts:
It appears that Drupal 7 lacks a good, user-friendly bulk node creation/file uploading module, and I'm wondering why.

Specifically, I'm wondering what unforeseen issues I'd run into if I tried to create my own. What hook would I use? What do I need to know about saving files and creating nodes out of them before embarking on this task? What terrifying monsters must exist in this terrain that it's never been tread?

My specific plan so far is to use the Form API and hook_form_alter to create a webform with a field that can do multi-uploads of images and then, upon submission, generate nodes with Title = image name and an image field that will get populated with the location of the image file.

Has anyone out there attempted anything similar with Drupal 7, and if so, what were your results / what warnings would you give?


texts: How do I filter a view (of feeds imported data) based upon the user that started the import?

texts:
What I'm really trying to achieve here is to get data from a third party hotel availability source (XML) and present that freshly received filtered list to the site visitor.

Here's the approach I've taken so far:

Entityforms collects the requirements from the customer (city, arrival date, duration of stay) which then redirects a local page to run the import with variables passed in the URL mysite.example/searching?city=' . $city . '&sDate=' . $arrive . '&nights=' . $nights . ''
mysite.example.local/searching then runs explodes those variables and passes them to the Feeds import
$URL = $_SERVER['REQUEST_URI'];
$link_array = explode('/',$URL);
$query = parse_url($URL, PHP_URL_QUERY);
parse_str($query, $params);
$kword = $params['city'];
$arrive = $params['arrive'];
$nights = $params['nights'];
// Define the id (machine name) of the importer you want to use.
$importer_id = 'availability';
// Load the Feeds Source object.
$feeds_source = feeds_source($importer_id);
// Override configurations...
$feeds_config = $feeds_source->getConfigFor($feeds_source->importer->fetcher);
$feeds_config['source'] = 'http://supplier.example.com?city=' . $city . '&date=' . $arrive . '&nights=' . $nights . '';
$feeds_source->setConfigFor($feeds_source->importer->fetcher, $feeds_config);
$feeds_source->save();
// Execute the import.
$feeds_source->Import();
Redirect to Views to present the data to the visitor. with header( "Location: http://mysite.example.com/hotels/" . $city . "/" . $arrive . "/" . $nights . "" );

I'm sure there is a better way to handle this, (but that's a subjective question, so I'm not asking it)

So, my problem is that I have no way to filter against the initial query. One way would be to add the Entityforms submission ID to the Feeds import, but I can't find how to do this.

My question is, can I pass a field value (the Entityform submission id would be ideal) to Feeds that will be saved in the node so that I can then filter my view on it?

For instance could I add a variable into $feeds_config['source'] = $entityforms_submission_id and that variable into the earlier redirect? (I can do the variable in the redirect bit!)


texts: How to manage form display non programmatically?

texts:
In Drupal 8, using admin/structure/types/manage/article/form-display, you can manage the form display for your content type. You don't have to rely anymore on contributed modules or on the implementation of the hook_form_FORM_ID_alter() or hook_form_alter() to hide an element in your form when you go to edit or add a node.

But in Drupal 7 we don't have this functionality, at least not yet. So, how to manage form display in Drupal 7 non programmatically?


texts: How to: Multilingual site with one front page that makes user choose a language first

texts: I want to have a front page like www.mysite.com/frontpage that shows up for every new visitor and helps him select a language and then move on to whatever language homepage the user selected.


texts:
Basing on existing content type (page) I have created another content type (page-without-video).  The only one difference between these two types, is that I am looking to skip a video section in the second one.  The rest should look the same.  After creating the "page without video" content type, I went ahead and adjusted custom css for the newly created content type (basically just changing the node name from "page" to "page-without-video").   From some reason the new content type did not inherit all the css coding of the "page" and has those default weird lines around images etc.  Is it a css problem or maybe I should look elsewhere to fix it?

I will appreciate any help with this.


texts: What is the correct way to 'fix' a site originally installed an developed using Composer, but deployed using FTP?

texts:
I have put together a site using the Drupal Varbase distribution. To do this I installed using composer, this is my first project using Composer. Now that I'm done in development I'm working on installing to our production server. I created the database and populated with the data from development, uploaded the code-base using FTP to 'public_html' on production and then proceeded to try load up the site. That's when I got my first 500 Server Error:

[17-Mar-2020 22:15:07 UTC] PHP Warning:  require(/home/vuunifcm/public_html/../vendor/autoload.php): failed to open stream: No such file or directory in /home/vuunifcm/public_html/autoload.php on line 16
[17-Mar-2020 22:15:07 UTC] PHP Warning:  require(/home/vuunifcm/public_html/../vendor/autoload.php): failed to open stream: No such file or directory in /home/vuunifcm/public_html/autoload.php on line 16
[17-Mar-2020 22:15:07 UTC] PHP Fatal error:  require(): Failed opening required '/home/vuunifcm/public_html/../vendor/autoload.php' (include_path='.:/opt/cpanel/ea-php73/root/usr/share/pear') in /home/vuunifcm/public_html/autoload.php on line 16

I am used to all the files required by a site being contained in the site's root folder, which for me is typically 'public_html'. It seems that composer is installed a level up and somehow the error is trying to reference components in higher directories where composer would be. I thought composer was more of a utility and not part of the actual website, but realise now I'm mistaken, so I uploaded the Composer files from the parent directory.

However, when I ran the Varbase install using Composer back when I created the site on the dev server, it placed the site in a folder called 'docroot', no 'public_html'. I had thought I would look for references to 'docroot' and see whether changing these instances to 'public_html' would help. I found them in the composer files. However, changing them just led to this:

[17-Mar-2020 23:09:56 UTC] PHP Warning:  include(/home/vuunifcm/vendor/composer/../../docroot/core/lib/Drupal/Core/DrupalKernel.php): failed to open stream: No such file or directory in /home/vuunifcm/vendor/composer/ClassLoader.php on line 444
[17-Mar-2020 23:09:56 UTC] PHP Warning:  include(/home/vuunifcm/vendor/composer/../../docroot/core/lib/Drupal/Core/DrupalKernel.php): failed to open stream: No such file or directory in /home/vuunifcm/vendor/composer/ClassLoader.php on line 444
[17-Mar-2020 23:09:56 UTC] PHP Warning:  include(): Failed opening '/home/vuunifcm/vendor/composer/../../docroot/core/lib/Drupal/Core/DrupalKernel.php' for inclusion (include_path='/home/vuunifcm/vendor/pear/archive_tar:/home/vuunifcm/vendor/pear/console_getopt:/home/vuunifcm/vendor/pear/pear-core-minimal/src:/home/vuunifcm/vendor/pear/pear_exception:.:/opt/cpanel/ea-php73/root/usr/share/pear') in /home/vuunifcm/vendor/composer/ClassLoader.php on line 444
[17-Mar-2020 23:09:56 UTC] PHP Fatal error:  Uncaught Error: Class 'Drupal\Core\DrupalKernel' not found in /home/vuunifcm/public_html/index.php:16
Stack trace:
#0 {main}
  thrown in /home/vuunifcm/public_html/index.php on line 16

Could this be the source of my problems or was my approach wrong? I feel like I've gone in totally the wrong direction. Can this be 'fixed', or do I need to start over with a different approach? I know there might be a workaround, but I don't want to be messing with workarounds everytime I need to update the site from here.

Just to confirm that the files do exist, this is part of how my folder structure looks:

|-- public_html
|   └── core
|       └── lib
|           └── Drupal \ Core \ DrupalKernel.php
└── vendor
    └── composer
        └── ClassLoader.php


texts: Redirect to view display after form submission

texts:
I'm using a form_alter hook to add a custom submit callback. I want to redirect the user to a particular page display of a view. However, I'm having trouble figuring out how to specify the path.

In my custom submit hook, I tried $form_state->setRedirect('/my-view/page/path'); but that didn't work. From searching, I found this question, Redirect after form submission, but the answers indicate to specify the machine name of a path from a routing yaml file.

I'm wanting to redirect the user to a views page display that I built in the UI, so I don't have any routing.yml file (that I'm aware of) where I could glean a machine name of a path from.

How do I set the redirect in a custom submit handler to a page display of a view?


texts: Print date and timestamp in views-view-field--blog--block-1--image.html.twig

texts:
How to print date and timestamp in views-view-field.html.twig ?

This is my html code

27 Mar

And this is code for timestamp

        6 mins ago

To look like this. This is html look.

Date and timestamp need to be add in

views-view-field--blog--block-1--image.html.twig


texts: OAuth token parameter missing when configuring Google Analytics Reports

texts:
I'm displaying Google Analytics reports at my site using Google Analytics Reports module which uses Oauth.

At the localhost on my computer it works fine.

But on a site my.example.com it is showing "OAuth token parameter missing" when I go to "admin/config/system/google-analytics-reports" and press "Start setup and authorize account".

I see this error in the watchdog:

  Code: 401 - Error: Unauthorized - Message:
  GDataauthErrorAuthorizationInvalid Credentials

If I migrate my site from localhost to this site then also it works fine until I clear my cache.


texts: Programmatically create a paragraph entity reference field

texts:
I need to create a config page, that is able to add social media information ( name and icon ), the user must be able to add as many social medias as it wants. To do so, I'we created a paragraph with two fields: name & icon, then I want to add this paragraph as an entity reference field programmaticaly in my config page, the paragraph machine name is social_media.

I tried this, but it didn't work:

public function buildForm(array $form, FormStateInterface $form_state) {

    $form['social_media_fieldset'] = [
      '#type' => 'fieldset',
      '#title' => $this->t('Social Media Configuration'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    ];

    $field = BaseFieldDefinition::create('entity_reference')
      ->setLabel(t('Type'))
      ->setDescription(t('The Paragraphs type.'))
      ->setSetting('target_type', 'paragraph')
      ->setSetting('handler', 'default')
      ->setSetting('handler_settings',['target_bundles'=>
                      ['social_media'=>'social_media']
          ]);

    $form['social_media'] = $field;

    return parent::buildForm($form, $form_state);
  }

the page is shown but without a form:


texts:
I have dedicated FreeBSD box, The email sending without smtp module is working perfectly but very slow. The receiver receives email after almost 15 mins. I checked the maillog it says delays and timeouts that means the server keeps on trying to send email again and again until it successfully sends one. This is consuming lots of CPU.

I am seeking help for configuring smpt module to use my dedicated box's  smtp server,
I need help in following places where I have ???? sign:

#SMTP server settings
SMTP server -> smpt.mydomain.com  # Tested by pinging, its working
SMTP backup server -> mail.mydomain.com  # Also verified by Ping
SMTP port -> 25
USE SSL

#SMTP Authentication
Username -> ???????
Password -> ???????

I tried using localhost, also username and password of the dedicated box or leaving both lines blank which gives me:

  Unable to send e-mail. Contact the site administrator if the problem
  persists.

also checking the debug log doesn't show any log, it says check admin/reports/dblog but when I got to the link it just shows me the contents from admin/reports no any dblog


texts: How do I override headers displayed in permissions tables?

texts:
I'm using Organic Groups on my (D7) site. I've set it up so that group managers can create new roles and change permissions in their groups. I've overridden some of the permissions using hook_og_permission_alter() to limit what they can actually change, and this seems to work well.

The problem I'm having is I want to alter/remove the section headers (ex. Organic Groups, Organic groups UI) that are set up by the different OG modules in this permissions table (I currently have three modules generating their own heading), and I can't find a way to do this. I can't find a hook that does what I want, and I've tried making sure none of the permissions are associated with the headings, but that didn't remove them. I guess I could edit the modules generating these headings and change their names to what I want the headings to display, but that really doesn't feel like the right approach here (and I'd rather remove the headings altogether anyways).

Does anyone know how I can approach this?


texts: How to add an additional uniqueness field that contains the “Feed Item”’s associated “Owner feed nid” value?

texts:
The same “Feed Item”can belong to multiple “Feed Source”’s but only one of these “Feed Item”’s will ever be imported because the same “Feed Item”’s uniqueness field will always prevent any additional “Feed Item”’s from being generated.  The way to allow the same “Feed Item” that belongs to a different “Feed Source” to be generated would be to add an additional uniqueness field that contains the “Feed Item”’s associated “Owner feed nid” value.

Does anyone know how to add an additional uniqueness field that contains the “Feed Item”’s associated “Owner feed nid” value within the /admin/structure/feeds/rss_importer/mapping section?


texts: How do I access the array of label values?

texts:
I can access the value of fields in my template using $view->style_plugin->rendered_fields.

How do I access the array of label values in my template file?

$datas = $view->style_plugin->rendered_fields;
print_r($datas);

// Response
// Array ( [0] => Array ( [field_company_name] => Google [field_registered_address] => USA ) )


texts: ReCreated a Content Type but it does displayed

texts: I seem to have run in to a problem when re-creating a Content Type, I had a Content Type called Gallery on my drupal 7.32 site, I then deleted it, but then wanted to create it again. When I re-created it , it says its saved but it does not appear in the Content Type list (Under Structure/Content Types), and therefore I cant add content to it. I did receive undefined index errors relating to Gallery when I created it (also shown under Reports/Field List), and went into the database and deleted the rows in Field_Config_Instance table as recommended on #5 item here  (delete occurences of rows which have Bundle field = Index). I have worked around this by creating a content type with a slightly different name, which works fine and no errors, but just wanted to know why I could not see a recreated Content Type (in case I have future problems)? I have flushed cache and run Cron, but that didnt resolve the problem. In fact Cron failed, but I reran again and it now works.


texts: What happened to the Devel variable syntax info info by double clicking on items?

texts:
Not long ago I could doubleclick on items like arrays, objects etc in Devel to see the syntax, if I wanted to fetch one value or another for example. That does not work anymore. I have tried using different Jquery versions, from core version up to 2.1. But that's not it.

Anybody?

I am sure this is a very stupid question... but I take my chances. I cannot figure it out.


texts: I created a views block to display the titles of nodes. I placed the block in the left side region. In order to see all the titles, I need to scroll down the page. Instead, I would like to add scroll bar to the views titles so I can simply scroll the bar to see the titles. How can I do it?


texts: How to reset Drupal's content cache / deleted content?

texts:
I'm working with Drupal 7.44. I created some content, but then deleted those articles. However, when I go to add new content, Drupal still recognizes the title of my articles that I deleted (as I'm typing it appears as an autocomplete below the field). I'm not sure if this is still completely stored in the database or if it's just cached somewhere. How do I go about deleting this (preferably without completely having to re-install everything)?

Administration -> Configuration -> Development -> Performance and "Clear all caches" did not seem to work.

Thanks!!


texts: Easist way to moderate an image via a php GET callback request?

texts: I want to add some code that allows me to use an image moderation service called Webpurify http://www.webpurify.com/image-moderation/documentation/callback/. I can send the url request using a rule (or using a hook via a custom module) and they send a callback GET request to a URL I specify, with the imageid and the moderation status directly in the url like this - http://www.yoururl.com/imgcallback.php?imgid=43534dfdfg3453sffsd&status=1. What's the best way to setup a call back page or url in Drupal? It's very simple it just publishes the node if accepted and deletes it if not.


texts: How do I dynamically change an autocomplete route for a field depending on another field's value?

texts:
On my node edit form, I have a select field (Field A) and another taxonomy reference field (Field B). Field B is currently using "views" as a reference method to filter for the options.

When the select field has a value selected, I want the taxonomy reference field to show a different set of autocomplete options.

I was wondering if there was a good way to dynamically update the "argument" for the views reference filter for the taxonomy reference field depending on what was selected in the select field?


texts: How to configure htaccess to redirect ALL traffic through https?

texts:
I'm looking for a way to redirect users to https://domain.com whether they type the www or not

I'm using a shared host for a drupal website so i don't have access to virtual host config files.
A let's encrypt certificate if included with the hosting package
Right now the website can be accessed both with http and https depending on what you type in the browser.
In looking for a solution to force redirection to https i found this section in the in the .htaccess file that redirects users who type the www. to https://domain.com

# To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment the following:
   RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
   RewriteRule ^ https%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]

Now i'm looking for a way to redirect when typing http://domain.com without the www.

Do i need to put another rule somewhere in addition to the line i uncommented or is there some other way to do this ?


texts: Disable Webform Componotent (field) after certain number of submissions

texts:
I'm working on a registration form that collects student information and the class session they're signing up to. Class sessions are of select type and has four options (sessions). Each sessions has a cap of 38 students. Is there any way to automatically disable options once submission count reaches the cap..? Please note that this is a field level condition, not the entire form level.
Would that be rules? Any pointers... thanks!


texts: I can't save changes of settings of an Omega subtheme. Problem just happens in remote server

texts:
I can't save changes of settings of an Omega subtheme in admin/appearance/settings/omega_subtheme_2

I get no error message. The changes are not saved at all.

This problem just happens in remote server. In my local server works just fine.

I guess it could be a folder or file permission problem. I already set the permission of site/all/themes/omega subtheme 2 folder and all its content to 777. But the problem persist.


texts:
When I add a new 'Basic Page' or an 'Article', a link to the Home page appears under the 'Main Menu' and I have no idea how to remove it.

How can I remove these links?


texts:
I built a module that submits the webform data to a soap api. The API an take a while to respond (out of my control), so what I'm looking for is a redirection hook, so I can go Submit->Force Redirection->submit to api.

Users are hitting submit more than once due to the api response time (understandably)


texts: Lightbox gallery is not working in mobile website

texts:
I am using D7 and lightbox2 for image gallery.

I'm using same in the mobile version too. But the lightbox popup is not opening and showing in mobile browsers. It will work sometimes and will never work on another occasion. What is the reason of this issue?

Using Lightbox2: lightshow:thumbnail->original  in content filed display, I used other options, but showed the same issue.

After that is used colorbox, it's working ok but when we close the popup window the parent window is blank and showing the same error undefined

  undefined

Also the page url is changed to the image url. E.g.,
www.site.com/sites/default/files/DSC_0164.jpg

Mobile jQuery 7.x-2.0-beta1 (default mobile theme by Mobile Switch)

How can I overcome this issue? How can I open image in modal window. It was working perfectly before, now it's showing the problem.


texts:
I have a set of images on a separate host, images are available by a URL. I would like to render one of these using Drupal's image styles, but I note that theme_image_style says it won't work with remote images.

Is this possible some other way?

I would like it to use Drupal's caching (so it doesn't fetch the original image every time).


texts: Delete "permanent" file when it has 0 uses

texts:
Files that are "used in 0 places" (viewable at /admin/content/files) are not being deleted automatically by cron. They also show a status of permanent.
How do I allow these files to be deleted by cron, or if not possible is there another way?


texts: Help, how to translate paginator in views? In my views I used a mini pager with tags backwards/forwards. Tried to do through translate interface, but nothing happened.


texts: How to detect order type (recurring or not) in order confirmation and shipping confirmation email templates?

texts:
When order is placed an emails is sent to the user generated with template commerce-order-receipt--default.html.twig
When order is shipped another email is sent to the user, now generated with template file commerce-shipment-notification.html.twig
How to detect from those 2 files if it's a first order (generated by user action) or it was recurring order (generated automatically, by cron)?
I need a way to display different content inside those emails based on this criteria.


texts: How to display more fields in an autocomplete reference field in Drupal 8

texts:
In an autocomplete field only the title of the entity reference is displayed to select it.
I would like to display more fields to be more accurate in the selection, but after many research and try different modules I still don't know how to do that :-(
Can someone help me please?


texts: Created a sitemap using the modules views and views data

texts:
I just created a sitemap using the modules views and views data export. How do I add

tag in the header.

thank you


texts: Set the custom initial date on FullCalendar based on a field in the current node

texts:
I would like to populate the custom initial date based on a field in the current node. Is this possible?

(bigger)

Update after looking at the module code

I snooped around the module code and noticed the line below.

if (!empty($settings['times']['default_date'])) {
    $settings['date'] = $settings['times']['date'];
}

(bigger)

Update 2: Hard coded test

Well this looks possible, I hard coded a test and it appears to have worked. The next step is to pull this value from a Node Field.

 // First, use the default date if set.
  dsm($settings['times']);
  if (!empty($settings['times']['default_date'])) {
    //$settings['date'] = $settings['times']['date'];
    $settings['date'] = array(
      'year'=>2012,
      'month'=>1,
      'day'=>2
    );
  }

Edit from file ./includes/fullcalendar.fullcalendar.inc near line 629


texts:
I am finding some troubles how Views works with taxonomy terms. I hope you can help me. :-)

I am building an e-commerce site with Drupal Commerce since it has all features I need for my project requirements but I don't know how I can list terms and nodes belong to concrete taxonomy on Views.

I have a product hierarchy taxonomy with all the site product categories. I use Taxonomy menu in order to show this taxonomy in a menu block allowing the user to select any term. A product display node only can be referenced to a sheet term on the taxonomy tree.

I want to use Views by listing as terms as nodes, if the user click on a non-sheet term on taxonomy menu, the view should show the subterms from clicked term. But in the other hand, if the user clicks in a sheet term then the view should show nodes referenced to the clicked term.

For instance,

Let's imagine I have the next taxonomy menu:

products

term1

term1.1
term1.2

node1
node2

term1.3

term2

node3
node4

If the user clicks on term1 term the view should list term1.1, term1.2 and term1.3 but if he/she clicks on term1.2 it should list node1 and node2.

How can I do this on Views? How can I list two different types of entities depending what term is clicked?

Thanks in advance!!


texts: Is it safe removing block-inner clearfix classes from block templates?

texts: Is it safe to remove block-inner clearfix templates from block? I use mainly context module which works with blocks. Looking at html there is too much wrappers involved. Thank you.


texts: render() is not returning anything on custom theme

texts:
I am using the newsletter_export module to allow users to select multiple nodes and export them as html. The node this action is performed on is a content type which uses entity reference to grab content from selected other nodes. The newsletter_export is also the name of the template file which renders it. It depends on the node_export module to do this.

However, it doesn't work on the theme that I am working with. It works fine on the Bartik theme. The code in the module that doesn't work is below: the variable for $raw_markup is always empty.

This level of coding in Drupal is new to me so any tips on fixing or just where to look to fix the problem is really appreciated! The variable $item is just the nid of the node.

$node = node_load($item);

  // TODO: Should we add the check for view hook back in for custom node modules?
  // Filter and prepare node in our custom build mode
  $render_array = node_view_multiple(array($item => $node), 'newsletter_export'); //, $weight = 0, $langcode = NULL)

  // TODO: Allow modules to change $node->content before the node is rendered.
  //node_invoke_nodeapi($item, 'view', $teaser, FALSE);
  $type = 'node';
  drupal_alter(array('node_view', 'entity_view'), $render_array, $type);

  // TODO: Set the proper node property, then unset unused $node property so that a
  // bad theme can not open a security hole.

  $raw_markup = render($render_array);


texts:
I have very little Drupal experience and recently inherited a Drupal 6 site. I want to make some CSS changes, but from what I can tell all the CSS is in /home/saybrook/drupal/sites/default/files/css, where there are a bunch of CSS files that seemed to be cached. If I make changes to those files, they'll probably be lost eventually.

Can someone point me in the right direction?


texts: Send email on comment to users depending on Taxonomy term selection in node

texts:
I need to send notification on new comment to users. But not based on node ownership, but based on what Taxonomy term is selected in node. It might be good task to accomplish with Rules module.

So i knwo to set event - after saving a new content
and Action - send e-mail

but for condition, i should somehow get the Commented node taxonomy term value.
But cannot find selector: Taxonomy term to do data comparison, or way to get taxonmy data for given commented node. Is this possible ?

Can the commented node object be checked - if custom PHP is selected for condition - so i can check selected taxonomy term value ?

Thanks!


texts: How to mass copy the title of each node to a taxonomy term?

texts:
I need to copy the title of nodes to its taxonomy term.
I have the following content type

Title - text
Body - text
Taxonomy term - (currently empty)

I want to copy the "Title" ---> "Taxonomy term" for each node.How can I do this?

I understand that VBO with som php-snippet could solve this but I am no programmer. Any suggestions about a working snippet or other solution?


texts: How to make Drupal 6 search result URL use "-" instead of space?

texts:
Example of Drupal 6 search result URL is like this:

http://www.site.com/search/node/Search for something

How to make Drupal 6 search result URL use - instead of space? (below is an example):

http://www.site.com/search/node/Search-for-something


texts:
I'm trying to set up entity autoloading using hook_menu like this:

    $menu['e-shop/produkt/detail/%commerce_datasheet'] = array(
    'title' => t('Products'),
    'page_callback' => 'commerce_products_datasheet_detail',
    'page_arguments' => array(3),
    'access callback' => TRUE,
     );

function commerce_datasheet_load($datasheet_id) {
  return entity_load_single('commerce_datasheet',$datasheet_id);
}

function commerce_products_datasheet_detail($entity, $view_mode='full') {
    dpm($entity);
}

dpm() function doesn't return anything, so I assume, that $entity is empty.

I am using latest versions on Drupal 7 and Entity API module.


texts: mysql errors after upgrading php and mysql

texts:
recently upgraded server to php 5.6.5 and mysql 5.6.22. running drupal 7.

after the upgrade we started having issues.

the server seems to run well for a week or so before starting to throw error pages with:

Notice: PDO::__construct(): send of 128 bytes failed with errno=32 Broken pipe in DatabaseConnection->__construct() (line 307 of /path/to/site/includes/database/database.inc).
Notice: PDO::__construct(): send of 128 bytes failed with errno=32 Broken pipe in DatabaseConnection->__construct() (line 307 of /path/to/site/includes/database/database.inc).
Notice: PDO::__construct(): send of 128 bytes failed with errno=32 Broken pipe in DatabaseConnection->__construct() (line 307 of /path/to/site/includes/database/database.inc).
Notice: PDO::__construct(): send of 128 bytes failed with errno=32 Broken pipe in DatabaseConnection->__construct() (line 307 of /path/to/site/includes/database/database.inc).
Warning: Cannot modify header information - headers already sent by (output started at /path/to/site/includes/database/database.inc:307) in drupal_send_headers() (line 1233 of /path/to/site/includes/bootstrap.inc).
PDOException: SQLSTATE[HY000] [2006] MySQL server has gone away in lock_may_be_available() (line 167 of /path/to/site/includes/lock.inc).
Notice: PDO::__construct(): send of 128 bytes failed with errno=32 Broken pipe in DatabaseConnection->__construct() (line 307 of /path/to/site/includes/database/database.inc).

when this happens, not every page shows the error, more like 25% or so.

so far i have had no luck tracking down the cause of the error. it seems to 'reset' if i stop/start mysql. such that if i stop/start i can get another week of no problems and then it begins again. this was making me think that it is a problem with a mysql setting related to connections or something, but i am no expert in this area and so am asking here.

after googling and seeing many posts suggesting to increase 'max_allowed_packets', we tried this but still the same issue occurs.


texts:
In Drupal 7 I use the ctools_custom_content (Custom content panes) module to create exportable panel panes to drop into my panel pages. This module doesn't exist for Drupal 8, nor do I see any other way to create panes with the Panels, Page Manager and ctools modules installed.

Have blocks, which are now entities, effectively replaced custom content panes in Drupal 8? Or is there a different core feature or contributed module that I should look to for similar functionality?


texts: Changes in test version applied in live version as well

texts:
On a D6 multisite setup, under the sites folder, there are a bunch of sites. Two of which are the sites testsite.domainname.com and domainname.com.
They have the folder structure I put at the bottom of this post.

So the problem is that changes made in the test version also seem applied to the live version, obviously with very
undesired results for the end users.
I checked the settings.php file to see if the same database would be connected to but the
data in both files are for different databases.

Changes applied to the test server that unintendedly have an effect on the live site
are not only limited to changes in the domain_custom.module file.
I noticed that changes made on the testsite in the page.tpl.php did the same thing;

testsite.domain.com
-modules
--domainname_custom
--nice_menus
-themes
--custom_theme
-settings.php

domain.com
-modules
--domainname_custom
--nice_menus
-themes
--custom_theme
-settings.php


texts:
Background:

Drupal 7.41 site, all is up2date, minimalistic in modules, no customizations.

The problem:

I've created a view of fields and filtered it via content-type. The content itself is being taken from the node fine, but it won't appeared grid. So, basically My question is constructed of two simpler questions:

What causes can avoid the grid display of working?
Can I implement grid display just to certain fields and not to all of them?...

Some images of my View settings:


texts: Would hook_access() hide content from Views/Solr if returning FALSE?

texts: If I were to setup my own hook_access() and return FALSE based on a few different criteria, would this then hide the content from a view in modules like Views and Apache Solr?


texts: How can I programmatically get the admin theme

texts:
Similar question to How can I programmatically get the theme name? and How do I programmatically change the admin theme?.

I want to simply obtain  the current admin theme machine name and human name, even when I might not be on a page where the admin theme is enabled as the active theme.

This information doesn't appear to be directly accessible via the ThemeManager class.


texts: How do I reset the number of failed login attempts?

texts:
I am trying to unlock the admin user of a drupal install using these instructions

http://www.aslingandastone.com/2011/how-to-reset-root-password-in-drupal-7-with-ftp-and-phpmyadmin/

But the user is blocked and email reset is not working:

  Sorry, there have been more than 5 failed login attempts for this account. It is temporarily blocked. Try again later or request a new password.

Where in the database can I reset this blocked status? The admin user's status is set to '1' in the user's table.


texts: Is there a module that allows me to add files via ajax to a body field?

texts:
I am using Drupal 7. I am looking for a module that allows users to drag and drop files (images/video/audio) inline into a body field with something like jQuery UI sortable. I would ideally like the user to be able to make a "media bank" in the node creation where they can upload their media and then drag and drop it where they want it in their post. Also, and I know that I am already asking a lot, it would be awesome if when the user added an image, they could resize it to the best fit for its position and placement in the body.

Do you have any suggestion, or anything close that I may be able to customize for my needs?


texts:
I'm trying to translate paragraphs in Drupal 8. According to this bug report, which is marked as fixed, it should work.
#2543258: Entity references of untranslatable fields are not displayed in the correct translation is supposed to be fixed as well.

I don't know if this has anything to do with it. Right now, I'm stuck and I even don't know if this really should work or not.

I'm doing the following:

In hook_preprocess_page there is $vars["node"] (as usual available via argument $vars)
On this node (could in fact be any arbitrary Node object, I guess) I will call $node->getFields()
One of the fields is a pararaph node ("field_sidepane")
I call "$field->view()" on this field to render the whole field (i.e. everything that's in the sidepane) at once. view() doesn't seem to support a second argument for the langcode or anything.
The sidepane contains multiple paragraphs (Cardinality=-1). One of these paragraphs contains a field "field_body" of type "text_long".
This field is marked as translatable (under the Paragraphs section of the config page). field_sidepane by itself (appearing under the Content section of the config page), however, is not marked as translatable.
Apart form the minor glitch, that these paragraphs are wrongly labeled as "All languages" (which I think is https://www.drupal.org/node/2463575) everything works great during edit-time. I can edit text separately for the different languages etc.
On the page, however, only the primary language is ever shown.

I thought it would be straightforward but I turns out to be surprisingly difficult. In the class Drupal\Core\Entity\Entity\EntityViewDisplay I discovered the following section:

      // The language of the field values to display is already determined
      // in the incoming $entity. The formatter should build its output of
      // those values using:
      // - the entity language if the entity is translatable,
      // - the current "content language" otherwise.
      if ($entity instanceof TranslatableInterface && $entity->isTranslatable()) {
        $view_langcode = $entity->language()->getId();
      }
      else {
        $view_langcode = NULL;
      }

I've found that if I set $view_langcode to NULL, it seems to work. Obviously, it gets the language from the main entity. But I don't know how I can change this in any way (either programmatically nor via the UI). Even if I explicitly use $node = $node->getTranslation("en"); and call getFields() on the result, it doesn't seem to work. I could find no way whatsoever to render the field in the translated language.


texts: Can administration menu be configured with a stripped down menu that only gives the user access to post content?

texts: How would I go about setting up stripped down administration menu so that non-privileged users can see a menu allowing them to post content that they have permissions for?  Right now the user sees no menus in their admin menu.


texts: Issue to pass argument to the function on button click in custom module

texts:
I have created a custom module in which list of mp3 tracks being displayed. After every track there is remove button and button id is actually nid of the track.

Now what I want is when I click on remove button particular button id (Which is nid actually) should be passed to the function remove_track.

Since I am new to the module development help me to know how to pass the argument to the function. Here is my code and screenshot hope it will help you.

function my_form($form, &$form_state)
{
 $tr = playlist_edit_gettracks(arg(1));
    $node = array();
    $pl_name=array();
    $pl_name=getplaylist_to_edit(arg(1));
    $tr = playlist_edit_gettracks(arg(1));
    $pl_name11=$pl_name[1];
    //array('page callback' => 'my_page');

$node['text'] = array(
    '#label' => 'selected',
    '#type' => 'textfield',
    '#id'=>'edit-playlist-name',
    '#value' => $pl_name[1],
);

for($i=0; $i<sizeof($tr); $i++){
    $node['tracks'.$i] = array(
       '#prefix' => '
',
       '#markup' =>'
'.$tr[$i]->title.'',
    );

   *$node['remove'.$i] = array(
       '#id' => $tr[$i]->nid,
       '#type' => 'submit',
       '#value' => 'Remove',
       '#submit' => array('remove_track'),   //HERE I WANT TO CALL THE FUNCTION AND PASS THE ARGUMENT
       '#suffix' => '
',
    );
}
$form['#submit'] = 'my_form_submit';
  //drupal_form_submit('playlist_edit_gettracks');
    $node['submit'] = array(
         '#type' => 'submit',
         '#value' => 'Update',
         //'page callback' => 'my_page',
         '#submit' => array('my_form_submit'),
    );
  return $node;

}


texts: Allow admin to discount line item price or give a user credit

texts:
I have a client who'd like to give certain users an arbitrary discount or credit to be used to pay for a class. In these situations an admin will create the registration (using the Registration module) which will automatically create a cart with this class as a line item. I'm having trouble figuring out what process to use to (from the user's perspective) correct the price for the course in cart.

My understanding is that there's no way to modify the price for the line item directly. Assuming this is correct (if this isn't please let me know!), my research indicates I'll need to add a line item to the order that will (from the user's perspective) reduce the price to where they want it.

What should this line item be? A discount? A coupon? Something else? And, whatever the right "thing" is, how does it get applied?

I've tried installing commerce_discount and have set up a discount, but I cannot for the life of me figure out how to apply it to an order. I've read through the info on this page --> https://drupalcommerce.org/user-guide/discounts-and-coupons, but if the answer I'm looking for is in there, I'm not finding it.

I've also just installed commerce_account_balance thinking that might work, and I am still testing it, but it isn't clear it will be a good fit for my use case either.

My assumption is that others must be doing this and I just don't know enough about Commerce pricing to recognize the one or more helpful answers that are already out there (stack exchange or elsewhere)...

Any direction / thoughts / help on this will be much appreciated.

Thanks

(question originally posted here - it was suggested there that I post questions like this here...)


texts: Cannot login to turn off maintenance mode after 7.24

texts:
I am new to Drupal, and although I managed to understand most of its principles, it seems I broke my site when trying to update it to the latest 7.24 release.

As instructed in UPDATE.txt, I entered maintenance mode and deleted all folders except sites/, which I had backup of course. I then copypasted all the new folders (including .htaccess) to my installation, and tried to run the update script. However, the update script said there were no pending updates. After that, the site was in maintenance mode, and even from my already logged in account I could not turn it off. I tried logging in again, and now I'm stuck in maintenance mode, and /user page redirects me to the main one. I tried emptying the cache tables, but nothing happened. I also tried copying the folders again, with no results. I enabled "update_free_access", and tried running the update script again, but no results.

Is there any way to avoid a blank installation?


texts: How do I create a link to add a new entity form from the referenced entity

texts: I've created an entity (using Entity Construction Kit) that has an entity reference field referencing a node. I would like to create a link on that node to create a new entity. I want to do this on the node template file. I have looked into sandbox module Prepopulate Create Node Links but I'd rather just code it.


texts:
I rebulding solr server after VPS crash, so I'm not completely newbie, but this time something went wrong and I can't manage the problem:

I configuring Apache Solr to use with Drupal. Acoording to may manuals Solr server URI should look like
xx.xx.xx.xx:8983/solr/corename

but my Solr ULR looks like

xx.xx.xx.xx:8983/solr/#/~cores/corename

However, Drupal reports "The Solr server could be reached", but when indexing I get errors:

SearchApiException while deleting items from server New SOLR server:
"400" Status: Bad Request HTTP Status 400 - HTTP method POST is not
supported by this URL The request sent by the client was syntactically incorrect.
SearchApiException: Could not index items since important pending
server tasks could not be perfor

med.

System info: Ubuntu 14, solr 4.7.2, tomcat 7


texts: Separate domain for specific content type

texts:
I haven't worked with multi-domain setups in the past so I did some research regarding the options for altering my website to accommodate for specific multi-domain needs.

My immediate need is to have a specific content type appear in links like:

http://my-content-type.my-website.com

According to what I've found so far, the Subdomain module fits my use case exactly however, there are 4 things that keep me from installing it:

Very small user base (272 sites using it according to drupal.org)
It's a beta version since 2011 and the latest dev seems to be 4 months old
It does not work with Global Redirect module (which I happen to use in my site)
I will most likely need full sub-domain support in my website in the near future (different theme, custom user paths in separate domains etc).

Based on that, I came across the Domain Access module which seems to be the way to go for my future needs having the added benefit of a large user base, frequent maintenance releases and a stable version.

My question is the following:

Is there a way to minimally setup the Domain Access module to suit my needs for now (give me the option to setup a custom content type as a separate domain) and configure any advanced settings later? Is there any other solution that my research did not reveal?


texts: Add another item by multivalued fields directly from node (or entity) view page

texts:
I have a file field which can have unlimited number of values. I am using File Entity module. As default, if users want to add more files, they must edit the node.

I'm looking for a solution to give the user the possibility to add another file directly from the node page where the files are displayed/listed. Just like the edit/delete functions from file entity, which the user can edit or delete an existing file directly from the node display using the contextual links hovering the file.

Is there any setting, API function or any hook that I can implement to provide this feature? Any advice will be very helpful.

UPDATE:

I don't want editable fields (Edit or Editable Fields as suggested as an answer. They may provide this functionality, but their main purpose is making fields editable, which is much more than I need and I already have the editing and deleting features through the File Entity module, and I only need this functionality for file fields.

I hope I was clear enough, otherwise I could expand my question and provide some screenshots.


texts:
I want to display the reading history of nodes using Views.
For this reason there is a history module in core, but the history_cron  hook deletes history older than 1 month.
I want to override this hook so that history is not deleted.
What should i do?


texts:
When creating directory using function drupal_mkdir in custom module, how to set folder permission access to "Create and delete files"?

drupal_mkdir('public://myfolder/');


texts: Printing to a strict template (multipage invoices / multiple delivery labels per sheet etc)

texts:
I would like to be able to print out hard copies of some strict templates.

Primarily I would like to eliminate the web browsers header and footer garbage that plagues printing from the web. I am prepared to be locked into a specific web browser for the purposes of printing such documents, as I understand this is a source of variability.

Specific examples of documents to be printed are:

Full page / multipage invoices that would require line breaks in specific places (and the ability to provide a custom page header for each individual page)
Printing to label paper (6/8 labels per A4), which would require fairly decent precision in order to print to the correct regions of the paper, as well as being able to specify page breaks for printing a multitude of labels across a many pages.

Is there a Drupal specific method for achieving this, preferably directly from browser to printer, although alternatively via PDF or some other means?

I understand that I might need to settle for something less-than-perfect, but anything available that is either Drupal specific would be greatly appreciated. For non-Drupal solutions, I have posted a similar question here at StackOverflow.


texts: drush aliases.drushrc.php file place and content

texts:
I need to upgrade a drupal 6.20 site to drupal 7 using drush sup

Installed drush using apt-get install. Upgraded it to the last version using drush self-update command and downloded the site-upgrade extension

Put the aliases.drushrc.php file under /home/mhmd/.drush/ contains the following

<?php
$aliases['newnour'] = array (
'root' => '/var/www/newnour',
'uri' => 'localhost/newnour',
);
?>

Navigate under the project path and typed drush sup newnour gahtering info finished and at the end
Site alias not found: newnour. See example.drushrc.php.

whoever typing drus sa lists newnour
@newnour
@none
@self
default

So what is the problem now please help me


texts:
How do I get multiple values (from one field) in a row in the node template? I have a field where a user can select up to 3 values. I would like that to be displayed this way:

  Industry: industry1, industry2, industry3

I don't want it displayed like this:

  Industry: industry1
            industry2
            industry3

I am using Drupal 7.


texts:
I want to add few jquery in my basic page of drupal website to call some api with parameter. Can any one explain me how can i accomplish this. $.ajax or $.post we can do right but its not happening in basic page.
I wanted to triggerd that jquery when i click html submit button... *in this case i am not using hook_form actully.**

This is only for one page...basically its a drupal basic page.


texts: drupal behat test assert authenticated by role with given fields

texts:
I am trying to run the following behat step:

@Given I am logged in as a user with the :role role(s) and I have the following fields:

This is defined in DrupalContext.php on lines 68-106.  I have a standard behat install from composer.  When I run this, I get the following error:

  --- FeatureContext has missing steps. Define them with these snippets:

  /**
       * @Given I am logged in as a user with the :arg1 and I have the following fields:
       */
      public function iAmLoggedInAsAUserWithTheAndIHaveTheFollowingFields($arg1, TableNode $table)
      {
          throw new PendingException();
      }

I am still pretty new to OOPHP so when I read this I took it to mean that it couldn't find the original method.  I added a use statement in my feature/bootstrap/FeatureContext.php:

use Drupal\DrupalExtension\Context\assertAuthenticatedByRole;

But I still get the same results.  Here is my implementation of the behat scenario:

@api
Scenario: An administrator should not be able to create a page content
  Given I am logged in as a user with the 'administrator' and I have the
  following fields:
    | field_user_username     | drupaltest  |


texts: automatically deleting non verified users after some time

texts:
By default Drupal requires an e-mail verification when a visitor creates an account. Is it possible to automatically delete all user accounts which are not verified after a month or so?

Would it be a good idea for Drupal Commerce websites?


texts: Get a list of field variables for template code

texts:
For Drupal 7, how do I access (or generate) a list of all the field variables available for building a template (for a given content type)?

Some context: I used to rely on the (now deprecated) Contemplate module to write my templates. Directly within its interface, it would print a list of all of the available variables, like this.

It was quite handy. Now that I'm making disk-based templates and do not have this list generated by the Contemplate module, I'm confused as to how I might produce something similar for use as a reference.


texts:
I have a D7 site with CKEditor + IMCE. The main site (www.example.com) IMCE works as expected. My staging site (cloned w/ Backup & Migrate) (staging.example.com) IMCE javascript is not working correctly.

Edit a node.
Click the image tool in CKEditor
Click "Browse server"
IMCE window opens
imce init function runs and adds the proper classes and such to the DOM
end of story...any click events from there on out have no effect.

Inspecting w/ Firebug or Chrome doesn't show any errors. I've tried to set breakpoints and watch variables but I need some guidance here about how to go about tracking down the root of my problem.

Thanks in advance for any advice.


texts: How to categories "custom search" results.?

texts:
I want to categories the custom search module results in 4 tabs. Ex tabs: Products,Downloads, News, FAQ.

Can you help on this?


texts: How can I retrieve parameters from the path?

texts:
I have a path

 /step/4?guide=6

How can I get parameters 'guide' and '6'in PHP?


texts:
I'm trying to add custom css class to a particular menu, same task mentioned here.

I moved a little further and found this article. So I put following code in template.php:

<?php
function phptemplate_menu_tree($tree) {
  if ($tree == menu_tree()) {
    $output .= "
";
    $output .= $tree;
    $output .= "
\n";
    return $output;
 } else {
  return '
'. $tree .'
';

 }
}
?>

but constantly getting 502 error when trying to compare $tree and menu_tree().

Can anyone suggest what am I doing wrong?

UPDATE

I've fixed the initial issue in the question and posted the solution here. Hope it helps.


texts:
How can I access a user image in Drupal 8? I am trying to use this code, but I am getting an error.

$account = \Drupal\user\Entity\User::load($q->uid);
$name = $account->getUsername();
$picture = $account->getUser_picture();


texts: Drupal won't validate required field when disabled

texts:
I have a content type with required field in it.
If the field is disabled then Drupal won't verify it. (it is being verified if not disabled).
How can I verify that the field has a value even if it's disabled?

More details:

For some of the users I set the value by Prepopulate and disable the field (by implementing the hook hook_form_alter).

I still want to prevent the user from messing with the URL.
For example: he can take the "new content" link I've created for him that looks like:

/node/add/my_type?edit[field_to_set]=12

and remove the URL query:

/node/add/my_type

I thought that if he would do it, he won't be able to save the form because of the required field (which is disabled) - but Drupal won't verify it.


texts: How do I customize an entity's canonical page?

texts:
I have an entity called SyncJob and it contains the following fields:

id
progress: integer
total: integer

I need to customize its view page (canonical, not the collections one) to show the following fields of one SyncJob entity:

id
status ('success' if progress == total, '' if progress < total)
percentage: progress / total * 100% as percentage

I have tried adding field plugins and altering views data but these seem only work on the collections view.
Is it possible to achieve these without writing HTML? If so, what kind of files do I need to create or modify?


texts: Imagefield submit breaks when I move it in the DOM

texts:
I've got a fairly straightforward "user profile" content type.  The design of the edit page for this content type has the Imagefield file uploader/thumbnail preview in the right sidebar rather than in the main content area.

I've tried several different methods to get this to work out, and none of them have yet worked.  The one I'd like to use is to grab the form-field wrapper with jQuery, and then append it to the right-sidebar region.  Like this -

$('#profile-pic-ahah-wrapper').appendTo('.region-sidebar-right .section');

For some reason, this renders the submit button on that form field totally unresponsive.  It's still there, it still shows up when I tinker with it in Firebug, but it doesn't respond to clicks or hovers at all.  I'm stumped for now, except that I guess this has something to do with it being AHAH?

Thanks in advance.


texts: How to customize user edit page drupal 7?

texts: I need to change the order in which things are on the user edit page in Drupal 7.  I have tried modifying page-user-edit.tpl.php and user-profile-edit.tpl.php, but it doesn't seem to ever get there. What can I do?


texts: Configure view to display a list of nodes with identical term id/name

texts: How could I configure the view to display a list of nodes that with the identical term id/name?


texts: using DrupalWebTestCase - any trick to prevent it from running from scratch each time?

texts:
It makes sense to run each test in a completely clean environment. However, before tests can be run, they have to be developed, during this process it is so frustrating to have to wait 3 or 4 minutes each time to see the result of any change/correction in the test.

Is there any trick to somehow resume the test in the environment where is finished or broke last time, without recreating the whole Drupal database? At this point, I am not interested in the tests to be 100% reliable, but rather in getting rid of more or less obvious errors in tests themselves.

For example, in my WebTestCase, I wrote $myfunction instead of $myfunction() and the test failed. The test so far created a content type, so in order to re-run it in the same environment, I would just delete that content type if exists, etc. It would be quicker.


texts: Pathauto alias produces inconsistent aliases

texts:
I have a content type with its own Pathauto pattern studios/[node:title]. What could be the reason that the alias of the node entitled "Studio A" is studios/studio, whereas for "Studio B" (for the same language) - studios/studio-b. The latter being the desired shape of course.
I tried to resave the node, I tried to bulk delete aliases and re-generate them - all to no avail.


texts: Updating modules creates An AJAX HTTP request terminated abnormally error

texts:
Drupal 7.77. I have three modules that need to be updated. Trying to update any one of them results in this error:

An AJAX HTTP request terminated abnormally. Debugging information follows. Path: http://www.mywebsite.com/authorize.php?batch=1&id=1069&op=do StatusText: ResponseText: ReadyState: 4.

Update Manager shows:

Notice: Undefined index: log in update_authorize_update_batch_finished() (line 187 of /home/mywebsite.com/modules/update/update.authorize.inc).
Warning: Invalid argument supplied for foreach() in update_authorize_update_batch_finished() (line 187 of /home/mywebsite.com/modules/update/update.authorize.inc).
Notice: Undefined index: log in update_authorize_update_batch_finished() (line 236 of /home/mywebsite.com/modules/update/update.authorize.inc).
Update failed!

I am not a coder and have no idea where to start.


texts: Panels added via Panelizer are deleted after going to node/edit and saving the node

texts:
I create an article and then "Customize this page" and add a panel to the page. I can re-save that page using panelizer over and over again with no issues. However, when I go into the "new draft" page and edit and publish the node, all items that were added with panelizer are removed from the article.

Very similar to this https://drupal.org/node/1572202 with the difference being that I notice it happens when I save from the node/edit page. I already have the patch on that page applied because it was added to the latest version of panelizer which I have.


texts: How to tell if a function is being called by javascript?

texts: I have a validation function that is being called either from another php function or a JavaScript call. I was wondering if there is a way to determine if the function is being called by JavaScript so that I can implement different functionality. I am using Drupal 7 for this but if you could post an answer for Drupal 6 too, I am sure that would help out other people as well.


texts:
After I added a language, and set as default language, I get this error.

  Error: Call to undefined function locale_translation_use_remote_source() in install_import_translations()

I didn't enable the Locale module yet. I enabled only the Language module.

What do I have to do?


texts:
I am trying to set up a simple OR condition.

If these "blocks" (red) are TRUE or these "blocks" (green) are TRUE execute the rule.

So I've tried added a OR block in various ways, but it does not succeed.

Basically what I want to achieve is that, if red block is NOT EMPTY or green block has value YES, the rule should execute.


texts: How to display an alternative text if the comments are closed for the node?

texts:
in my node type template, how do I display alternate text if comments are closed for the node ?

  {% if content.comment %}

      {{ content.comment }}

  {% else %}

      {{ content.field_link }}
      {{ content.field_code }}

  {% endif %}

EXAMPLE

  If comments are open :

  {{ content.comment }}

  If comments are closed :

  TEXT


texts:
I get an fatal error on the 'add content page'.

Fatal error: Cannot use object of type stdClass as array in

function mymodule_form($form, $form_state){
    $form['mymodule'] = array(
        '#type' => 'textfield',
        '#description' => t('Please enter your text here.'),
        '#required' => TRUE,
    );
    $form['mymodule_submit'] = array(
        '#type' => 'submit',
        '#value' => 'Submit this form'
    );

    return $form;
    return node_content_form($node, $form_state);
}

The problem's happen when I add my form, when I use only the

return node_content_form($node, $form_state);

it is working fine, what do I wrong?


texts:
I'm having an issue with deciding how to display nodes that in turn point to panel pages.

My site currently has a lot of panel pages that have static content. I have a view on my front page that displays nodes which in turn point to these panel pages. However, when a user clicks on a node link, they'll of course see the node in isolation.

In order for me to point users to the correct page, I've been using redirects. So if a user clicks on featured article on the home page,  a redirect pushes them to the panel page I've set up instead of just the node view.

Have I made this overly complicated? Is there a way to making this workflow a lot simpler?


texts: Issue a html.tpl.php override from a module?

texts:
Is there a way to override the output of a page from a contributed module and issue your own html.tpl.php, effectively taking control of the output from the theme?

I want to do this in effort to create a unique login/registration experience, but can only seem to override the page level template, not the html level template. I see that the print module kind of does this, but is that the way to approach it?


texts:
We have an Article that a link field, field_link. When we create a new page of type Article, we set the link field to have a URL of www.example.com/somepath?someid=123345 and label of View. When the page is rendered, we are seeing the query parameter is being removed (i.e. ?someid=123345). We are not doing any hooks or extra logic in twig templates to remove the query parameters.

How can we prevent the query parameters from being removed when rendering the field_link field?

Current behavior when link is rendered:

View

Expected behavior

View


texts: Removing posted by admin date from a contact form

texts: I am making a contact form in Drupal with using panels but in contact form it is showing posted by admin date. I want to remove these two things as shown in image.


texts:
I have created event using Calendar in Drupal Commons. I need to implement RSVP for these events Details like FB event section.

Kindly guide me to create RSVP plugin in Drupal Commons. I just searched the web to get some reference link for RSVP Implementation in Drupal 7. In that link, user nicoz commented "Use the flag module ".

I just installed flag module and create that flag like Participant/Maybe/No, but I cannot achieve it, because a flag will only provide flagged content and unflagged content.

Kindly give me any idea for this type of flag creation or else give me alternative module for  RSVP functionality.


texts:
When getting a 403 error, Drupal is not redirecting to the URL configured in the Site Information settings. Instead, it keeps the URL in the address bar of the browser, uses the page template (page--XYZ.html.twig) for that same URL and only the content of the page ({{ page.content }}) reflects the URL I've configured in the site information settings.

Does anyone know how to get a full redirect to the configured 403 page?


texts: extend('PagerDefault') doesn't call pager_default_initialize

texts:
My code:

   $num_per_page = 1;

   $query = db_select('redagavimas', 'r')
      ->fields("r");
   $query->join('dusers', 'd', 'd.id = r.user');
   $query->join('companies', 'c', 'c.id = r.company');
   $query->join('documents', 'doc', 'doc.id = r.doc');

   $query->addField('d', 'name');
   $query->addField('d', 'surname');
   $query->addField('c', 'name', 'company');
   $query->addField('c', 'id', 'companyID');
   $query->addField('doc', 'name', 'docname');
   $query->addField('r', 'user', 'did');

   $query->extend('PagerDefault')->limit($num_per_page);
   $query->extend('TableSort')->orderByHeader($header);

   ....

   $result = $query->execute();

   ....

     '#suffix' => theme('pager', array( 'tags' => array())),

I don't see any pager; If I call somewhere pager_default_initialize(), then I see the pager. What I did wrong?

EDIT :

I try:

echo $query->extend('PagerDefault')->limit($num_per_page)->getCountQuery();

and get query, which return >100 rows.


texts: How to message or invite a group without joining it?

texts:
I'm using the Group module. I created a group(Job Post) with linked content types (Job details).

Scenario:
As a user, I created several jobs.

I want to be able to invite/message another group (Business) for them to be aware of my posting without joining this group.
Also, because I have more than one active jobs, I want to select a job to send the invite about.
Lastly, if I have already did an invitation to that group, I can no longer send twice.

Question: How can I achieve these three items above?

Note: a User is someone who creates or posts a job (example: electric power shortage). Businesses are created groups, like electricians. The user should invite this business to get notified about his job.


texts:
I have a input box created with html need to put in the specific block. I saw posts writing there to add the html by function but i cant do it since it is php file
Is it right way to do this? what is the exactly way to do this?
    function firstmodule_block_view($delta = ''){

$block = array();

switch ($delta) {
    case 'signup':
    $block['subject'] = t('Newsletter signup');
    $block['content'] = myblock();
    break;
}
    return $block;
}

function myblock(){
//html code goes here????
}


texts: Architecture Guidance: Many off-the-shelf templated sites

texts:
I typically work on larger custom projects, but have found I have a lot of requests for projects at a lower price-point. I think I can serve this audience by creating a core Drupal installation profile, supplementing it with features, and installing one of a dozen or so custom themes I'll make.

I'd like this process to be as plug-and-play as possible. Right now I have an installation profile so all I need to do is 'git clone' the repo for that and then 'drush make' and 'drush install' to get up an running really quickly. This profile does some really basic things (sets admin theme, sets a development theme, installs an 'image gallery' feature which includes a content type and a taxonomy, etc).

So far I'm stumped on how I should develop things like layout (panels, display suite, theme templates?) and default content (devel generate?) during installation. Should I develop a base theme (I use a custom inuitCSS framework) and write sub-themes for it?

Has anyone else put anything else similar together? Do you have suggestions?

This has become a pretty complex endeavor and I'm wondering if it would be better to just build a site for each theme, zip it up and export the database.


texts: Drupal Commerce Mirgrate product displays

texts:
I'm trying to create a migration class for my product displays. I already have one for the product variations which is seperate because it has a different CSV source.

So I'm just trying to create the drupal nodes of the product displays. When I check the database in the node table, the nodes are there with the correct type. However when I go to the product page, I don't see the new items there.

I think it has something to do with this line:

$this->destination = new MigrateDestinationNode('video_storage_recorder');

or

$this->map = new MigrateSQLMap($this->machineName,
      array(
        'Name' => array(
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'description' => 'Recorder',
        ),
      ),
      //MigrateDestinationCommerceProduct::getKeySchema('commerce_product')
      //MigrateDestinationEntityAPI::getKeySchema('video_storage_recorder')
      MigrateDestinationNode::getKeySchema('video_storage_recorder')
    );

where video_storage_recorder is my content type.

Also I tried

$this->destination = new MigrateDestinationEntityAPI('video_storage_recorder');

But no different behaviour.

I think the nodes are created but not considered products for Drupal Commerce. But I don't know why.
Also Migrate does not give any (error) messages and just says 9 items were created.


texts: Export content in features using UUID features

texts: I read the UUID feature description and it says it is used to export content in feature. I installed the module but did not know how to export the content.


texts: AJAX request failing each time I try to invoke php function from module

texts:
I'm trying to invoke a AJAX request whenever someone clicks a download button on my drupal site.

In my module I have referenced the javascript file in the (my-module).info as follows:

scripts[] = js/my_module.js

my_module.js:

(function ($) {
  $(document).ready(function(){
    $(".book-purchase-button").click(
    function(){
        $.ajax({
        type: 'POST',
        url: '/foo/ajax/tag',
      success: function(){
        alert("AJAX Call Successful!");
    },
      error: function(){
        alert("AJAX Call Failed!!");
    }
        });
    });
  });
})(jQuery);

I figured I could do a menu callback to capture the AJAX request based on the url

my_module.module:

/*
*    Implements hook_menu().
*/
function my_module_menu()
{
  $items = array();
  $items['/foo/ajax/tag'] = array(
    'title' => '',
    'page callback' => 'my_module_tag_user',
    'access arguments' => array('access content'),
    'access callback' => TRUE, // allows access to any user
    'type' => MENU_CALLBACK,
  );
  return $items;
}

But for some reason the AJAX request keeps alerting me that the ajax call has failed... Is there something I'm doing wrong?


texts:
I have a requirement to allow users to subscribe content type. When a new node of the subscribed content type is created, notification mail must be sent. I tried notify module but it only allows to subscribe while registration.

Is there any solution for unsigned users to subscribe a content type?


texts: "Manage display" tab missing in Manage fields window

texts:
I am editing and working with fields for a Content type but can only see Field settings, widget type and delete tabs. The Manage display tab is missing.

How do I make it display?

I am running drupal 7


texts: Show all children of a specific taxonomy term using Views exposed filters

texts:
I have a Views exposed filter that checks nodes with specific terms. I can't seem to find an option to display all children of a term if the parent term is selected.

For example, I will outline a vocabulary:

Parent 1
 - Child 1
 - Child 2
 - Child 3
   - Another child
Parent 2
 - Child again

If I select "Parent 1" as part of my filtering process, it will display any nodes tagged with that Term. However I'd like it to display all children as well as just the term.


texts:
I have several Schools and each School have 7 Domains. Each Domain has 3 unique forms. Here is a graphical representation of it:

I want an interface in which I can search a School by using Views (this I can do). When I click a School, the next window comes with a dashboard which has these 7 Domains and each Domain has 3 forms which is associated with the selected School.

Can anyone tell me how I can achieve this?


texts: How to embed a block (with title) in a template file?

texts:
I've created some blocks (not related to any other module, just through the "add block" option) and I am attempting to call them in the correct places in my homepage template.

I found the following code:

$block = module_invoke('block', 'block', 'view', '1'); //where 1 is block delta
print $block['content'];

But this only allows me to display the block content. Is there a way to get the block title too? I did find some people using $block['title'] or $block['subject'] but my $block array only seems to have the content in and nothing else.

Apologies if this is a common question but I couldn't seem to find an answer for the life of me!


texts: Where do I find a list of commonly used features?

texts: I've been searching around for some useful features.  I would assume that there are some common features that people use all the time, like an image gallery. Is there a place where people contribute these? I have searched Google and drupal.org but can't seem to find anything.


texts: How to add a RSS Feed to a solr search view in drupal 7?

texts:
I'm trying to add a rss feed to my website.
It has content indexed by a a solr search and somehow when I try to add a RSS feed it says:

  Style RSS Feed requires a row style but the row plugin is invalid.

Also in the edit view the following message is shown:

  Show: Missing style plugin

using drupal 7, solr, and views

Using a 'normal' view RSS 'page' can be created

How do I add the missing style plugin and where do I find this plugin?


texts: How to add fields wrapper in field preprocess

texts:
My code:

function MYTHEME_preprocess_field(&$vars, $hook) {
  $element = $vars['element'];
  if($vars['element']['#field_name'] == 'field_example') {
    foreach($vars['items'] as $key => $item) {
      $vars['items'][$key]['#prefix'] = '
';
      $vars['items'][$key]['#suffix'] = '
' . $item['#item']['alt'] . '
';
      $vars['items'][$key]['#suffix'] .= '
';
    }
  }
}

I want to wrap all items in a div. I should use some code outside the foreach, but I hadn't found any solution. Can you help me?


texts: Hide views tab display on user profile to profile owner

texts:
I have a use case where I need to create a page for members of two specific roles (Contributor and NAD Contributor) to see their own unpublished content. Using views relationships and filters, I've created a tabbed page display at the path user/%/unpublished that only displays unpublished content belonging to the logged in user. All that works great except for one thing; the tab itself is visible on all user accounts, even though it's only visible to users of the specific roles. What this means is that there is a Unpublished tab (with no content) for other roles that don't need this page, so for instance the two Contributor roles would see an Unpublished tab on users of other roles.

Is there a way within Views to control the display of this tab to only be displayed on the profile pages of the roles specified in the Access settings for the display?

Thanks.


texts: How to choose multisite instance inside script running from main Drupal directory?

texts:
As in question. I know that I can use drush command, but I have small script and I don't want to create module from it. Now I calling that script inside main Drupal folder (no multisites).

Inside that script I just bootstraping Drupal (I need Access to Drupal API):

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
#db integration

(The same PHP header I use for e.g unit tests class)

It is possible to run such script in multisite enviromnent too?

My problem is that every sites config settings.php has db name called 'default'. So I don't know how to use db_set_active properly.

I have script that creating data  (txt file) for Menu Import module. I need access to Drupal and Joomla db, because I need to migrate menu from Joomla.

Anyway here is a script


texts: How to remove the RSS feed icon form the content listing pages?

texts: I need to remove the syndication icon because I'm either not going to syndicate or I want to do it my own way.