texts: How to give users access to the header or footer text in a view?

texts: I have a view with a "global text" header that changes once a month. It's not easy in Drupal to give users access to only certain fields in a view. And I wouldn't want to "scare" them with the views UI either ;-)


texts: How do I declare a Telephone field in a content entity?

texts: I want to create a custom content entity with a telephone field. I'm baffled on how to do it; I can't figure out what should go into setDisplayOptions() to have it show up as a telephone field on the form. Does anyone know where I could find an example of this?


texts: where to find default view code in user relationships module in drupal 7?

texts: I have installed user relationship module. Which gives me default views to display the list of friends, received requests and sent requests. I want to show a message to the user about the number of requests he/she has received as we see in facebook. But I am not getting the view's machine name, display name to take a count of requests received as I am not getting which is the view for requests received. Where Can I find it?


texts:
I added a new view (block) with FIELDS type. I added "Content: Comment count" to see the comments number, and in "Rewrite results" I clicked to "Output this field as a link", and added the token "[comment_count] == Content: Comment count" as link.
This link doesn't work.

When I add a different token, such as "[body] == Content: Body" or "[title] == Content: Title," the links still don't work.

Am I doing anything wrong?


texts: Context module not changing page title tag

texts:
Issue is, that in my case Context module isn't changing <title> tag of the page.

I've configured Context module to change Meta tags (title and meta description) for specific view pages of my site for specific language.

I have two conditions:

Language
Path

and one reaction:

Meta data

This Context module has changed meta description, but title tag hasn't changed, it shows default value.

Is there some kind of a tweak to get it working properly? Or am I doing something wrong?


texts: Exporting a group of pages as a single or multiple PDF programatically

texts:
I would appreciate any pointers on this problem.

I have a site which have a set of pages with a given content type, I would like to take all these pages and generate a single (if possible) PDF with the content of each page.

I'm able to write some PHP code but I'm not sure where to start or what modules would help me with this issue. I have checked other answers but they talk more about having an option to click and export a single page where I want to export a dozen/hundreds of pages.

Thanks


texts: Multiple Date Argument Values with One Contextual Filter

texts:
I have a pretty simple view in D7:

Fields

nid
title

Contextual Filters

nid
date (from date, monthly granularity)

Now I'd like to fetch some results for a specific node, but across multiple months. I was hoping to be able to pass in the contextual filter arguments via the url like so:

123/201302+201303

This isn't working for me though. Is this even possible with Date fields in Views ? I heard it was only possible with term ids right now.

Are there other techniques to accomplish this? Perhaps hook_views_query_alter() is in order here.


texts: Separate drupal view filters from the results

texts:
I implemented a search index using Drupal Search API, and then created a view using that search index. In my view I added filters on searchable fields. My search is working very well.

However, my clients want to have the search filter controls in the sidebar and the search results in the main content region. But my filter controls and results are part of a single view. It is possible to separate them?

Drupal version : 7.26


texts: synchronized views on a Panel using AJAX

texts:
Using drupal 7, I have two views (map and table), both with the same exposed filters, inside of a Panel.

Currently these views are View Panes, both with the parameter 'Use Panel Path': Yes, and AJAX: no

One of the view's filters is hidden to the user, so we simulate a single filter for both views.

When user filters the data, all parameters are sent via GET and both views are correctly updated, but it causes a refresh of all the page and we have a very long GET request.

So I want to use AJAX to synchronize both views. I have done some tests using AJAX 'yes' in both views, changing the Panel Path... but I think I am not on the right track.

thanks in advance


texts: By default, Drupal uses site.com/?q=user or with clean URLs enabled, site.com/user to display the user login page. However, that is conflicting with my hosting provider's own rewrite settings, where navigating to that link brings up the actual web server admin login. Is there a way to override this?


texts:
I got a field with xyz as machine name, and I created a field--field-xyz.tpl.php template file, but it does not take any effect.
I used the template file to add views-field and views-field-field-xyz as CSS classes, but they don't show up.

What did I do wrong?
Is it because I am using the Adaptive theme?


texts: How to check if an item exists in a Queue?

texts: While inserting items in a Queue how can I check if the item I am trying to insert is already present in the Queue?


texts:
In order to get a necessary jQuery plugin to work I had to upgrade my jQuery version to 1.4.

To do this I installed jquery_update and manually put 1.4 in the module directory.

That's working just fine for the public facing side of my site, but now various AHAH elements (like Views UI or FileField uploads) no longer work on the admin side.

I'd like to use Drupal's jQuery for admin/edit pages, and jquery_update's jQuery for everything else.  What's the least hacky way of doing this?  Or is there a totally different solution for this?


texts:
I can see that Fast 404 module has been added to drupal core since 7.9 version.
So in order to use it on my drupal site(without installing Fast 404 module),is there I need to do in the settings.php module?
thanks


texts:
I added a node-product.tpl.php file to my theme and it is completely ignored.

I reset the caches, multiple times, and tested with devel + devel_themer to see that the name was correct and it is. It says it searches for:

node-product.tpl.php
node-product.tpl.php
node.tpl.php

Why would the core theme() function not find that template?

My only answer would be that somehow the theme path is not yet available in the theme() function at the time the product is being generated.


texts:
I've been using the Prepopulate module for a while, and it works really well. It can't prefill an addressfield type field, though.

How can I achieve this?


texts:
I have an Embed View on a custom content entity to be used with views_embed_view().
I'm trying to understand how contextual filters work on this view.
So, I use Devel 'Run php' to execute the function containing this:

$view = views_embed_view('services', 'embed_2', someparameter);

And in my module, I have coded this:

function sel_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
  if ($view->id() == 'services' && $view->current_display == 'embed_2') {
    ksm(something);
  }
}

When something is $query->where, I get the expected result:

But when something is $query (to have more information on the query), I am redirected to Drupal installation!

Any idea why?

If I can't make ksm($query) work, where can I find documentation on the query object (methods, properties)?


texts: How to assign a CKEditor profile to a specific field?

texts:
I'm learning Drupal and right now CKEditor.
I want my website to have a blog, with a complex editor for the articles, and a much simpler one for the comments. I have created two different profiles in CKEditor, but now I'm stuck and don't know what to do next...

Thanks for your help.


texts: How to find out which cron jobs are currently running?

texts: Is this possible to find out which cron jobs are currently running?


texts: I have a content type which the editors (who don't have an administrator role), needs to set the idioms that the field is translatable. For example, he can say the title and the body are transtalatable. What is the best way to do it programatically? I thinked about use hook_field_language_alter, but i'm not sure.


texts: Installation profile missing after upgrade to 8.6.1

texts:
I did an upgrade from Drupal 8.5.6 to 8.6.1 and the installation (minimal) profile broke. I noticed that the minimal.install file was removed from the installation profile. I assume this is related to how the install profiles and dependances are changing in 8.6.x -- but this upgrade completely breaks a whole lot of things.

Anyone else have an idea on how to restore the install profile?

I am still digging around to see why this file was removed but any insight would be awesome.


texts: Form error messages appearing in the middle of the form

texts:
I've got a hopefully EASY question. I'm using a Drupal Commerce-based form in my Drupal 7 site. The form has some required fields. When a user clicks the button to 'continue registration' at the bottom, and they hadn't filled out all the required fields, the form, of course, throws error messages in an error block that tells the user certain fields are required.

But the error messages are not showing up in the correct location. Please see the image below. The main error that there are problems with the form is displaying correctly at the top of the form, but then the problems with individual fields are displaying in THE MIDDLE OF THE FORM. Obviously, not ideal.

So, how do I make all the errors display at the top of the page?

I've already checked my tpl file for the page and the $messages variable is at the top.


texts: How to integrate custom fields with the Rules module?

texts:
I want to integrate the D7 custom field module I wrote with the Rules module so that values can be copied from my custom field to other fields and vice versa.

So far I got this function that is defined as the property_callback in the _field_info function:

function b2share_field_property_callback(&$info, $entity_type, $field, $instance, $field_type) {
  $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];

  $property['getter callback'] = 'entity_metadata_field_verbatim_get';
  $property['setter callback'] = 'entity_metadata_field_verbatim_set';

  $property['property info'] = array(
    'doi' => array(
      'type' => 'text',
      'label' => t('DOI'),
      'description' => t('Subfield of Field "'.$field['field_name'].'".'),
      'getter callback' => 'entity_property_verbatim_get',
      'setter callback' => 'entity_property_verbatim_set',

     ),
    'pid' => array(
      'type' => 'text',
      'label' => t('PID'),
      'description' => t('Subfield of Field "'.$field['field_name'].'".'),
      'getter callback' => 'entity_property_verbatim_get',
      'setter callback' => 'entity_property_verbatim_set',

  ),
);
unset($property['query callback']);
}

The subfields of my field show up in the rules config menu, but when I try to do something with them their values can't be accessed.
EDIT: Meaning that my field and its subfields have values stored. When viewing a node you can see them, when you edit the node you can see and change them. They are displayed in a view, but when I try to copy them using a rule an empty string will be copied to another field. At the same time no values can be set for my custom field using rules.

This is my rule for testing. It is supposed to add some string to the field, but doesn't have any effect.

  { "rules_edit_b2share_link" : {
    "LABEL" : "Edit B2Share Link",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : {
      "node_insert--data_set" : { "bundle" : "data_set" },
      "node_update--data_set" : { "bundle" : "data_set" }
    },
    "DO" : [
      { "data_set" : { "data" : [ "node:field-b2share:doi" ], "value" : "44444" } }
    ]
  }
}

This is the second rule, that's not working either. It ends up copying an empty string to the "abstract" field.

  { "rules_copy_b2share_link_to_another_field" : {
    "LABEL" : "Copy B2Share Link to another field",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_update--data_set" : { "bundle" : "data_set" } },
    "DO" : [
      { "data_set" : {
          "data" : [ "node:field-abstract:value" ],
          "value" : [ "node:field-b2share:doi" ]
        }
      }
    ]
  }
}


texts: How do I do a 'required if other field = x' using the entity validation api?

texts:
I have a field in a content entity that is required if another field in it is checked, otherwise it can be blank.

My guess is that I'd need to make some kind of Validation Constraint Plugin for this - is there an easier way to do this, or a module where something like this already exists?


texts: Preprocess Node function not being called

texts:
I'm attempting to perform an action in a preprocess node hook inside my .theme file, but I can't seem to get it to fire.

Here's the content of my customtheme.theme file

<?php

function mytheme_preprocess_page(&$variables){

    $menu = \Drupal\block\Entity\Block::load('custom_main_menu');

    $variables['main_menu'] = \Drupal::entityTypeManager()
        ->getViewBuilder('block')
        ->view($menu);
}

function mytheme_preprocess_node(&$variables){
    die('Test');
}

Everytime I load a node, even though I have a die() statement in my mytheme_preprocess_node function it never fires, and the page loads just fine. I'm making sure that I'm loading pages that are nodes. Such as basic pages, and other custom content types. What's odd is that the mytheme_preprocess_page function does fire. It's able to load the main_menu variable inside the page.html.twig template just fine. I also made sure I was clearing the cache.

Why would a preprocess_page hook function fire but not a preprocess_node function.


texts: We have 90,000 nodes and it is currently re-indexing every hour (via cron) 200 pieces of contents. How can we have it do it all at once?


texts: Is it possible to make a patch that modifies a module's composer.json?

texts:
I want to confirm some behavior of Composer to see if this is a limitation of Composer or something I did wrong.

This is based on an issue in the Markdown module queue.

Basically, here's the issue.

The Markdown module requires ^0.15 of a library.
I wrote a patch to require ~0.15 of the library. (to allow 0.16, 0.17, etc.)

But, when I apply this patch via Composer, and then try to update the library, I still get a drupal/markdown  1.2.0  requires  league/commonmark (^0.15.0) even though the module's (patched) code on my site requires ~0.15.

So, is there no way to "patch" a composer.json so that it will be picked up for composer update?  Am I reliant on the module maintainer to commit the patch?


texts: What's wrong in my code for setting up entity title in a Computed Field?

texts:
I have written inside a Computed Field's Computed Code section the following code:

<?php
//work if the node is new and there is no value for the field yet
if (empty($entity_field[0]['value'])) {

  do {
    //calculate a promotion code
    $new_promotion_code = strtoupper(substr(md5(rand(999, time())), 0, 5));

    //check db for conflicts
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'node')
      ->entityCondition('bundle','gift')
      ->fieldCondition('field_gift_code', 'value', $new_promotion_code)
      ->addMetaData('account', user_load(1));
    $result = $query->count()->execute();
  } while($result > 0);

  //assign the field value
  $entity_field[0]['value'] = $new_promotion_code;

  //option#1
  //$entity->title[0]['value'] = $new_promotion_code;
  //option#2
  //$entity->title[LANGUAGE_NONE][0]['value'] = $new_promotion_code;

  //presave the node with attached fields (not sure if this is working)
  field_attach_presave($entity_type, $entity);
}
?>

This code works except the commented out section which includes two options for setting up same node's title. I am also not sure if field_attach_presave() works but I have no means to debug it and it just doesn't fail like field_attach_update().

Using Auto Entity Label is also a solution but the token ([node:field-gift-code:rawvalue] or [node:field-gift-code]) for this field just prints Array.

Any suggestions?


texts: DrupalDefaultEntityController invalid argument supplied for foreach

texts:
Been trying for the last hour to work this one out.

$query = new EntityFieldQuery();
$query -> entityCondition('entity_type', 'node')
       -> entityCondition('bundle', 'subscription');

$results = $query->execute();

if(isset($results['node'])) {
    $subscription_nids = array_keys($results['node']);
    $nodes = node_load_multiple($subscription_nids, TRUE);
    return $nodes;
} else {
    return FALSE;
}

This is a very simple version of the entire query, but the error is exactly the same:

Warning: Invalid argument supplied for foreach() in DrupalDefaultEntityController->buildQuery() (line 290 of /var/www/ml/data/www/ml.mailapproved.com/includes/entity.inc).

I don't understand what's wrong here.


texts: Drush dl with dependencies on a multisite environment

texts: When downloading a project using drush dl <project> in a site specific folder on a multisite environment, the module is being downloaded to /modules. However, the dependencies are being downloaded to /sites/all/modules. Is there a way to force Drush to download the dependencies to the site specific module folder using Drush 5?


texts: How to prevent comment posting when it has specific words in it?

texts:
I´ve searched for all Drupal 7 modules that try to give some SPAM protection, but haven´t found what I need, maybe I´ve overlooked something?

I need to prevent anonymous comment posting when comment has specific -configurable- spammy words. How may I do that?


texts:
i've made a form which update the price of a product. The user just need to select a duration by a select-list and it update the price by an Ajax callback. It update well the price but it change the structure of my select and then the select when is changed again does nothing...

The form inputs :

$key = array('field_friterie_suggest', 'MY-PRODUCT-SKU');

$form['content']['deals'][$key[0]]['purchase']['value'] = array(
            '#type' => 'select',
            '#name' => 'update-price-'.$key[0],
            '#options' => array(
                5 => t('- None -'),
                0 => t('1 month'),
                1 => t('3 month'),
                2 => t('6 month'),
                3 => t('1 year'),
            ),
            '#default_value' => $default_purchase_value,
            '#ajax' => array(
                'callback' => 'fritr_commerce_update_pricing_callback',
                'wrapper' => 'pricing-'.$key[0],
            ),
            '#attributes' => array(
                'data-update' => array(
                    'pricing-'.$key[0],
                ),
                'data-type' => array(
                    $key[1],
                ),
            ),
        );
        $form['content']['deals'][$key[0]]['purchase']['pricing'] = array (
            '#prefix' => '
',
            '#suffix' => '$
',
            '#markup' => 0,
        );

And my callback :

$month = $form_state['triggering_element']['#value'];
    $price = 0;
    if ($mont != 5) {
        $month_definition = array(1,3,6,12);
        // get the product by his SKU
        $product = commerce_product_load_by_sku($form_state['triggering_element']['#attributes']['data-type'][0]);
        // get the product price and reduction
        $product_base_price = ($product->commerce_price[LANGUAGE_NONE][0]['amount'] / 100) * $month_definition[$month];
        $reduction = $product->field_commerce_reductions[LANGUAGE_NONE][$month]['value'];
        // set the new price
        $price = $product_base_price - ($product_base_price * ($reduction/100));
    }
    return array (
        '#prefix' => '
',
        '#suffix' => '€
',
        '#markup' => $price,
    );

So my input become :

<select data-update="pricing-field_friterie_suggest" data-type="MY-PRODUCT-SKU" class="form-control form-select ajax-processed" id="edit-content-deals-field-friterie-suggest-purchase-value" name="update-price-field_friterie_suggest"></select>

to :

        <select data-update="pricing-field_friterie_suggest" data-type="MISE-EN-AVANT-SITE" class="form-control form-select ajax-processed" id="edit-content-deals-field-friterie-suggest-purchase-value" name="update-price-field_friterie_suggest"></select>

Then when i change the value of the select, it does nothing. Can you help me please ?


texts: How do you create a colorbox popup on the frontpage of D7?

texts: I'm using Colorbox and Drupal 7. I'm trying to create a Colorbox of an Image on the front page in a POP-UP. The problem is I can't figure out how to get it to show up on page load. How can I achieve this without adding an additional elements showing on the frontpage?


texts: How do I set/get third party settings on a content block?

texts:
I have a content block type, and I'd like to add a couple of simple configuration options to it without setting up "real" fields. I primarily used this for instructions:

https://www.webomelette.com/drupal-8-custom-data-configuration-entities-using-thirdpartysettingsinterface

My module code:

use Drupal\block_content\Entity\BlockContent;
use Drupal\Core\Form\FormStateInterface;

function oa_blocks_form_block_content_slider_images_edit_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $block = $form_state->getFormObject()->getEntity();

  $form['autostart'] = [
    '#type' => 'checkbox',
    '#title' => t('Autostart'),
    '#default' => $block->getThirdPartySetting('oa_blocks', 'autostart'),
  ];
  $form['#entity_builders'][] = 'oa_blocks_block_content_slider_images_form_add_form_builder';
}

function oa_blocks_block_content_slider_images_form_add_form_builder($entity_type, BlockContent $block, &$form, FormStateInterface $form_state) {
  if ($form_state->getValue('autostart')) {
    $block->setThirdPartySetting('oa_blocks', 'autostart', $form_state->getValue('autostart'));
    return;
  }
  $block->unsetThirdPartySetting('oa_blocks', 'autostart');
}

I have the following in config/schema/oa_blocks.schema.yml:

block_content.type.slider_block.third_party.oa_blocks:
  type: mapping
  label: 'Slider Block'
  mapping:
    autostart:
      type: boolean
      label: 'Autostart'

I get the following error when I try to edit the block:

Fatal error: Call to undefined method Drupal\block_content\Entity\BlockContent::getThirdPartySetting() in /Users/dicksb/Sites/devdesktop/drupal8/docroot/profiles/mogov/modules/mogov/mogov_blocks/mogov_blocks.module on line 17

What am I doing wrong?


texts:
I'm not even sure I know enough about Drupal to ask the question properly, but here goes.  I've managed to make a drupal view that displays submitted locations on a map of people who all received the same physical card. Under the map, anecdotes etc of how people received that card appear. I'll spare you the rest of the details.

You can see what I mean here:
http://www.wwghosting.com/sevendeg/final-leaf-test

Anyway, what I would like now is: if someone searches the site, for say card 2701, they will be shown a page that looks like that.

The problem is, I had to manually make that view with a filter that filters out card #2701 and anyone who submitted that card.

If I had to do it that way, I'd have to make 5000 views manually if we had 5000 cards. Also, the map there is just shown in the header of another view, so really, it's two views in one page.

What I want is for a display similar that to be automatically made if someone searches for card 2701. Or once they submit a card, I want them to be redirected to that page.

I think somewhere I read that it is possible to render a view from URL info, but not sure if that's the way to go about things.

Thanks in advance for any help/guidance.

-Todd


texts: Solution for the URL Alias and question marks issue with Webform

texts:
I am developing a site in Drupal 7. I am using webform for creating a "contact us" form. After submitting the from successfully, the page is redirected to a confirmation page where the url is http://www.somesite.com/node/11/done?sid=3. I want this particular url as http://www.somesite.com/thankyou.

I tried to set the url alias for node/11/done?sid=% as thankyou. But unfortunately it doesn't work for me.

Any suggestions about a solution for this?


texts: Change profile makefile download location?

texts: This is similar to Changing Drush make default subdir for install profiles, but with a twist.  I'm using a set of nested profiles to inherit default modules, each with a makefile.  Unfortunately, this causes the modules specified in each profile to downloaded to that profile's /modules folder.  Is there any way to specify where files in a discovered .make should be placed (such as /sites/all/modules), even if in a profile?


texts: How to add classes to image fields set to Unlimited and a "rel" attribute to the  tag that wraps them

texts:
I have an image field set to Unlimited and I have some questions on how to display them:

How do I display only the first image while all the rest are hidden (has class="hide")?
Add a rel="something" attribute to each  which wraps

Answer to #1 found! After several tests, simply capture the field by adding this to your field.tpl.php file. This will insert the hide class to all succeeding images after the first one.

<?php if( $element['#field_name'] == 'field_gallery') : ?>
  <div class="<?php print $classes; ?>" <?php print $attributes; ?>>
    <div <?php print $content_attributes; ?>>

      <?php $i = 0; foreach ($items as $delta => $item) : ?>

        <div class="field-item <?php if($i > 0) print 'hide '; print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>>
          <?php print render($item); $i++; ?>

      <?php endforeach; ?>

<?php endif; ?>


texts: Is Drupal doing something to JQuery delegate or click() that causes the binding to fail?

texts:
I am trying to implement a simple mobile menu, but using Nice Menus as my base. So to get things the way the snippet's CSS is set up, I'm using JQuery to dynamically add a <button> element that can be clicked.

Problem is, nothing happens when I click the button. I've checked that my code works fine when the user clicks a <p> element. And I have also confirmed with code that the element to which I'm attaching the click function exists. (But it wasn't working with a $(document) scope either.)

Doesn't work:

$('.nice-menu-main-menu').before('<button class="nav-button">Toggle Navigation</button>');

if ( $('.nav-button').length > 0 ) {
    console.log("nav-button element exists"); // console shows this message
    $('.nav-button').click( function() {
        console.log("menu button clicked"); // never see this message
    });
}

Doesn't work:

$( document ).delegate('.nav-button', 'click', function() {
    console.log("button clicked"); // never see this message
});

Does work:

$( document ).delegate('p', 'click', function() {
    console.log("button clicked"); // console shows this, no problem
});

What magic am I missing? I figure the issue must be with the dynamic aspect of the  element, but everything I'm finding in the documentation of JQuery and similar code online suggests this should be working.


texts: How do I troubleshoot a node not appearing in workbench?

texts:
I have a bug report where a user is not able to see 'Draft' status nodes that they have just created in their workbench interface (at /admin/workbench). They are able to see other nodes in various approval phases.

I've backported the site to a local development environment and logged in as that user and I'm able to re-create the issue. Also, with my administrator user, I have the same issue -- the new node doesn't show up in my workbench queue either. However, it does show up in the content overview. The problem is that for most users, we only give them workbench queues to access content, and not the content overview.

I've looked at the various configurations for workbench, and at the fields on the new nodes, and I don't even have a starting point as to what to look at to troubleshoot this issue. My users are able create and publish content on a daily basis, so there's not a major misconfiguration in the site.

What makes a node appear in a workbench queue in Drupal 8? We have both the workbench and workbench_access modules enabled. I'm not sure how these interact with the core workbench features.

Edit I noticed in the module page that "Workbench core is a series of Views", so I looked in the views on our site. We seem to be using the built-in-views, so I edited the "Workbench: Recent content (Content)" view, and removed the Filter Criteria "Content: Published status or admin user". I thought this would prevent my user from seeing the new node. However, after I removed that filter criteria, the draft node still did not appear in the preview of that view. So that doesn't seem to be causing the problem.


texts: Wrapping a rendered file from Media module with a link

texts:
This is a question related to this post.

I'm using Media 2.x to create an image field, called Background Images, in my custom content type. A user is able to upload multiple Background Images and then these are displayed as rendered files.

I'd like to wrap each Background Image in a link redirecting to another distinct page that will then use that same image by pulling it in from the URL along with the node it is associated with. From the post I linked to above, I saw that the Linked Field module was an option.

I've been able to configure by going to Structure > Content Types > [my_content_type] > Manage Display > Background Image > Link this field

where the destination I am asking it to go to is:

node/add/canvas?field_movie_parent=[node:nid]&field_background_image_reference=[node:field_background_image_reference]

But I end up getting:

node/add/canvas?field_movie_parent=%5Bnode%3Anid%5D&field_background_image_reference=%5Bnode%3Afield_background_image_reference%5D

If I hard code the values, I can redirect to the page successfully, e.g. where field_movie_parent=1 and field_background_image_reference=1. I'm having trouble with how to dynamically generate the values and am wondering if this is even the right approach. Any thoughts or advice would be appreciated.


texts: How can I use the Private Message module for anonymous users?

texts:
I am using the Private Message module as a way of contacting the author of a node.

I have the problem that the button that says "Send author a message" only appears on the node when the user is logged in. If the user is not logged in, then the button that appears is the one that says "Log in or register to be able to post comments" (or something like that)

What I want to achieve is that the user (not logged in) can see the "Send author a message" on the node. And when this user clicks on this button he will be taken to the login form first, and then, after login, the user gets redirected to type the message to the node author.

How can I achieve this?


texts:
I have no experience with php and I've been trying for hours to alter the HTML of a profile 2 (module which extends core profile functionality) page. How can I do this?

Ideally I'd like it so I can just alter the page and add things like:

<div>
    <?php print $name ?>
</div>

Thanks


texts: Importing Content Without Including `nid`

texts:
I have this site I develop, and the way the process works is that I have three versions of the same site: Production, Staging, and Development.

I've been working on some new features on Development, but over time, new content has been added to the Production version. Now that I'm done with the development for now, I'd like to copy the new Content Types + Nodes I've created in Development to Staging, which I've turned into a clone of Production, but I keep running into this issue: when I import content, it always includes the nid, so it overwrites content that has been created on the live site, which I can't have.

I've tried Features, Data Export Import, etc, but they all include the Node ID with the information, so existing content is always getting overwritten when I import.

What solutions are there for importing nodes WITHOUT also importing the Node ID with it? I essentially need to use Node Clone's functionality, except instead of creating the cloned node locally, it exports it to be created on the Staging site.


texts: Features components spontaneously reverting

texts:
On a multisite, we're using Features + UUID Features to manage a large quantity of default node and menu content.  Users can easily spawn a new multisite instance; the installation profile enables a set of Feature modules which create nodes and menu items.

Some of our users have reported that site content, which has been intentionally overridden by local site users, is spontaneously reverting to the version of content stored in the Feature.

What might be causing this?  What can we do to prevent it?


texts:
Super strange, my site was up and working fine yesterday. Today, I navigate to my home page and I'm thrown this series of errors:

Warning: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in DatabaseConnection->__construct() (line 321 of /var/www/html/includes/database/database.inc).
PDOException: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in lock_may_be_available() (line 167 of /var/www/html/includes/lock.inc).

To the best of my knowledge, this only occurs when the database connection settings are incorrect in the settings.php file, but all of mine are correct (and have been for quite some time). Any idea why this would suddenly change and throw this error? I'm stumped.


texts: How to check if result from cache_get() is expired?

texts:
cache_get always returns an object and I'm a bit confused by its values. There's probably a short generic function that can handle this for once and for all.

$cache = cache_get('key');
if ($cache) {
  // doesn't work, cache_get always returns an object
}

if (!$cache || ($cache->created < time() - $cache->expire)) {
  // cache is expired? I'm not sure
}

Just checking for the data member doesn't cut it.

I had seen the issue reported on d.o (in 2009) but that doesn't really help me fix it on any live site. So I'm looking for a function that will still make cache work for me without resorting to storing the cache myself in the database.


texts:
Which is the right way to render a file in a custom view mode?
I'm using Media, 7.2 branch, I've custom view modes and I want to print in a tpl a file (based on fid) in the view mode "header_image".


texts:
How do you choose the display mode for a node that is used on an taxonomy page?

As default the nodes are displayed using the node-teaser mode but i would like to create a custom style for nodes that are show a taxonomy page.

I could change the teaser mode to what i need but then that would be changed on every place the teaser view is used.


texts: Flickr module other than flickr_bricks that doesn't need API key?

texts:
I want to include publicly available pictures from Flickr in a Drupal site. The Flickr module looks great but needs an API key. This seems overkill when I only want public pictures.

The flickr_bricks module does not need an API key but it only lets you set tag filters globally. Is there anything that supports setting different tag filters for different galleries on the site - by block or node, say - but doesn't depend on a key?


texts: How do I run queries against a view configuration

texts:
Where is all the config for Views stored? I am working on a Drupal site with a very large number of Views. What's the easiest way to find "All the Views which have a Relation of a certain type", or "All the Views which output a specific field?"

It would be nice to do this with some SQL but I'm stumped as to how.


texts:
In the Date module I'm trying to customize #date_popup; is it possible to completely eliminate the Timepicker field; it currently displays Date + Time fields. I only want the Date field and can't figure out how to remove it in Drupal and/or the Dashboard.

Anyone tried this?

Thanks!!!


texts: How can I add a log entry to watchdog every time form_set_error() is triggered on user_account_form_validate()?

texts:
I'm not much of a coder so I'm having a real hard time figuring this out.

I have a custom module and I'm trying to override user_account_form_validate() (from user.module) so that I can add a watchdog entry every time a specific instance of form_set_error() is called:

elseif ((bool) db_select('users')->fields('users', array('uid'))->condition('uid', $account->uid, '<>')->condition('name', db_like($form_state['values']['name']), 'LIKE')->range(0, 1)->execute()->fetchField()) {
  form_set_error('name', t('The name %name is already taken.', array('%name' => $form_state['values']['name'])));
}

I need to do this because sometimes the Email registration module causes this error to fire and I want to make sure that this doesn't occur; so, to ensure users aren't seeing this error, I want to log it in watchdog if it occurs.

I know I can hack core and add the following line just after form_set_error:

watchdog('mymodule', 'Registration error: %name was already registered.', array('%name' => $form_state['values']['name']), WATCHDOG_ALERT);

But how I can I do this without hacking core?  I tried various permutations of function

  function mytheme_user_register_form_validate (&$form, &$form_state) {}

in a custom module but I couldn't successfully get Drupal to use my function instead of the core one.


texts: How to display registration form fields based on the taxonomy term?

texts:
I have three taxonomy terms. And I want to display different fields in the registration form based on the taxonomy term.

I want something like this.

taxonomy term 1:
Registration form fields: Name, Email, Password, City, phone

taxonomy term 2:
Registration form fields: Name, Email, Password, Country

taxonomy term 3:
Registration form fields: Name, Email, Password, State, phone

Is it possible? if yes then please guide me.


texts: Drupal 7 Views Multiple Jump Menus in single page not working

texts:
I have two Jump Menu block (views driven) into single page.

The first Jump Menu block is working fine - Drop Down Content type - Using Ajax

While on Second Jump Menu showing an error of "An Illegal Choice has been detected. Please contact the site administrator." - Drop Down of Taxonomy Term Id

Do any one know how to resolve this issue ?


texts:
I'm happy to say that I've succeeded in importing an Access database into MySQL and getting a table from it to show up in Views. Progress! Thank you for all the help I’ve been getting here to overcome the hurdles along the way.

So now, the first webpage I'm working on has a rather unusual HTML table on it that’s a bit of a hack and I wonder if Views is capable of making it or if I need to find a different way.

You could call what I’m trying to do a “dynamically indented text display.”

On the current website, the javascript that builds the main part of the HTML table looks like this:

'
' + (nLevel == 0 ? '' : ' 	') +
     '' +
          (sHeading  == '' ? '' : sHeading + ' ') +
          (sParty    == '' ? '' : '' + sParty + ': ') +
          (sURL      == '' ? '' : '' + sLinkText + '') +
          (sNotes    == '' ? '' : sNotes) +
          '	' +
     '
'

In the data table, every row has (a) a value of nLevel between 0 and 12, inclusive, and (b) either a value of sHeading or a value of one or more of the other text variables. Therefore, every row of the HTML table has either a heading or a text block, and whichever it is is indented by an amount controlled by nLevel.

Two elements of simple logical processing stand out there:

     The numeric variable, nLevel, determines the level of indentation by a pair of  tags in which the sum of the “ColSpan” parameters is 13. So there are 13 levels of indentation (from 0 to 12) across the page. (On the current page, the width of the indentations is set by 12 repetitions of “&nbsp;	” in the first row of the table.)
     A link is constructed from the variables sURL and sLinkText.

I see that Views allows for the calculation of a math expression in the construction of a table, but I don’t see anything that allows for this kind of programming there. So I’m thinking a Views table won’t work, unless there’s something I don’t know.

It’s possible that an HTML list could work if Views allows for nesting of lists, which would control the indentation. When nLevel increases from one row to the next, it always increases by one, so this gives the same behavior as “
” (plus a bullet, which I could live with). But still, I would have to be guiding Views programmatically in its placement of “
” and “
” tags, and I don’t see how I would do that.

Maybe now you can see why I was originally thinking of just translating the code from javascript to PhP and putting that directly on the page. The code is pretty simple, so that would be easy. (The part that I still don’t know how to do is how to connect to the database with a query to get the values of the variables above.) But when I posted my question about whether this was a good idea, I got some strongly worded advice that it’s usually a very bad idea to put PhP code directly on the page.

So what is the right way to get Drupal to do the kind of dynamically indented text display described above?

Thanks for your help.


texts: Views: add (link to file field) to image field

texts:
In D7, I have an event content type containing an image field ("Featured image") and a file field ("Document"). I have a view of events containing documents, and would like to wrap a link around the image, leading to the document. Here's a sample link.

How can I rewrite the image (or use another technique) to get the desired link around the image? Looking at available tokens (I did add a second, hidden Document field above the image to define tokens), nothing seems suitable. Thanks for your help.


texts: Programmatically delete term from taxonomy term from all referring term reference fields

texts:
I would like to be able to programmatically delete a taxonomy term from all instances of term reference field that targets that terms vocabulary.

My reason for this is that I believe I've encountered a bug where by when I delete a taxonomy term itself, the database record for related term reference fields remains.

I've field a bug report at: http://drupal.org/node/1281114 however in the meantime before the massive drupal core machine gets around to addressing the bug, I'd like to try and solve it myself temporarily until there is a more robust and core solution.

Is there a 'correct' way to delete a taxonomy term from each instance of fields term reference using Entity API or perhaps a core function?

Thanks


texts: How do I programmatically add and fill a field to taxonomy terms of a specific vocabulary?

texts:
I want to programmatically do two things:

Replace the default multiline Description field of taxonomy term
with my own, plain text, single line field. I mean - to visually
replace - I understand this is an entity property and all I can do
is to hide it and create another, plain text field.
Populate the vocabulary through taxonomy_term_save() - putting the description strings into the newly created field.

Would anyone be kind and provide a skeleton of code to achieve it?


texts:
I am using  the Drupal 7's Bartik theme.

It wraps with <p> the content-type fields that are set as "long text," but not the fields that are set as "text."

Where do I change this so that it wraps every field with <p>?


texts: Report complains about Unsupported Release but no modules listed

texts:
On my report page, I get a warning about Unsupported Release of modules or themes.

but when I click the "available updates" link, the next page tells me that all my projects are up to date.

I've tried clearing my cache and running cron but I get the same result.

EDIT:

Apparently this is a known bug that I missed in my searches. Unfortunately, the link to the bug below doesn't include any info on how to find out WHICH modules are unsupported. :( So, I have no way to figure out which things I need to upgrade or remove.

Where can I find a list of the unsupported modules in my installation?


texts: Disabling language prefix for route in module

texts:
How can I disable the automatic redirect to the language prefixed URL for a URL defined in a routing.yml in my module?
I'm developing a custom sitemap.xml module, because the Simple Sitemap XML module does not have the options I need. I've got it just about working, except the URL /sitemap.xml 301 automatically redirects to the URL /lang/sitemap.xml - and it really shouldn't. How can I disable this redirect?


texts:
I'm developing a videogame store with Commerce (I'm n00b in Drupal), so for example I'm adding a new game "GTA V", GTA has versions to XBOX360 and PS3, so I'm trying to create the product and add two variations for PS and XBOX with different prices and some stuff, but I don't need a product page where the user selects PS or XBOX version, because I'm splitting my site by consoles, so if the user is in XBOX section, I need to list only the XBOX variation and not the PS variation.

I'm trying to achieve this because I don't wanna repeat myself with description, videos, etc of video games, so in the "GTA V" example I will write just one description and not two (for PS and XBOX) that will be the same.


texts: How to subscribe to notifications or alerts via RSS feeds?

texts: How would I go about adding the functionality of subscribing to notifications or alerts via RSS feeds for certain pages/documents or images?


texts: What is the best way to add a comment policy to the comment form?

texts: Surely this is a common use-case... I would have thought? Underneath "Add new comment" heading I would like to add a block of text like "Comments are pre-moderated and may be edited before publication". I have an internationalised site so the text must be translatable.


texts: Drupal Form Suffix + Suffix As a href + pop up the drupal users listing with checkboxes by click on that link

texts:
I have requirement like ..

I have to put one link in the  Drupal Form, That i achieve with using suffix while creating Drupal form..

Now I want to pop up the list of all drupal users & their email ids with checkboxes by on click that Link..

now if i choose the check box in front of particular user .. the name of the users with semicolons replace that link that i made with suffix..

so how to achieve that...? Any suggestions guys..?


texts:
I need a function to return the nid of the current node that the current user is watching.
Can you help me?


texts: Why does my select list not translate to another language in Views?

texts:
I have a View for Search in property, which has many fields and some of them are drop-downs (select lists).

When I switch the language to Arabic, everything is translated, but the drop-down is still in English (= default language).

I performed these steps:

I translated my select list in Manage fields and translate the options there
then I put them in Manage display to default translated.

But it's not working. Check the image for more details:

Any ideas about how to solve this problem?


texts:
I am dynamically populating <select> throught javascript in Drupal 7. The system gives me an error on submit:

"Illegal Choice has been detected"

How to mark, that this <select> must skip this error?


texts:
The theme I am using has a slider -- a panel of automatically changing images to display a topic that the user can choose -- but it only shows a few slides.  I want to extend it to a dozen slides.  I did simple text searches to determine which files in the theme are used code files to provide the functionality to the slider.  That was the easy part.  I was able to extend the code from the few slides to 12 slides.

Now comes the more difficult and hidden part.  As I see it, each slide has two parts that are not hard coded.  First, each slide has a caption -- a text description.  Secondly, each slide has a URL associated with it that is where the browser goes if the user clicks on the slide.  These two things are not hardcoded in any of the PHP or other files, as far as I can tell.  They can be edited by the admin in the drupal backend admin settings.

So I assumed that these fields are somehow set and retained in the database.  But I did a search on a downloaded copy of the database and I did not find this text.

Please advise.  What additional work do I need to do to complete this task?

The theme is called "impact_theme" and as far as I can tell all the code for it resides in

sites\all\themes\impact_theme

The README.txt file for the theme is:

About Impact Theme
====================
Impact Theme is a Drupal 7 theme. The theme is not dependent on any
core theme. Its very light weight for fast loading with modern look.
  Simple and clean design
  Drupal standards compliant
  Implementation of a JS Slideshow
  Multi-level drop-down menus
  Footer with 4 regions
  A total of 10 regions
  Compatible and tested on IE7, IE8, IE9+, Opera, Firefox, Chrome browsers

Browser compatibility:
=====================
The theme has been tested on following browsers. IE7+, Firefox, Google Chrome, Opera.

Drupal compatibility:
=====================
This theme is compatible with Drupal 7.x.x

Developed by
============
www.devsaran.com

Slideshow photos by http://www.flickr.com/photos/68666702@N00/

Help and Support Us
=====================
Please consider a small donation
Paypal ID : donation@devsaran.com

============================================================================

I made a subtheme according to this page: https://www.drupal.org/docs/7/theming/creating-a-sub-theme.

I logged in to the Administrative Dashboard and I made the subtheme as the default theme.

And then the website immediately crashed and I am unable to see anything apart from "HTTP ERROR 500".

What do you think I should do now?

For completeness sake, I will list here the screenshots I made when I was comparing my modifications to the original theme.

I am thinking what I should do now is try to step back and see if I can narrow down the point where the website crashes.  But in order to do that, I wonder if it will do any good to just modify the files.  I mean, the subtheme is already set as the default theme.  How can I undo that without being able to log into the Admin Dashboard?


texts:
The html.html.twig template contains the following line.

<html{{ html_attributes }}>

On my site, it outputs the following markup.

<html lang="ru" dir="ltr" xmlns:article="http://ogp.me/ns/article#" xmlns:book="http://ogp.me/ns/book#" xmlns:product="http://ogp.me/ns/product#" xmlns:profile="http://ogp.me/ns/profile#" xmlns:video="http://ogp.me/ns/video#" prefix="content: http://purl.org/rss/1.0/modules/content/  dc: http://purl.org/dc/terms/  foaf: http://xmlns.com/foaf/0.1/  og: http://ogp.me/ns#  rdfs: http://www.w3.org/2000/01/rdf-schema#  schema: http://schema.org/  sioc: http://rdfs.org/sioc/ns#  sioct: http://rdfs.org/sioc/types#  skos: http://www.w3.org/2004/02/skos/core#  xsd: http://www.w3.org/2001/XMLSchema# ">

What plugin or core function controls it?


texts:
How to attach programmatically a view to the edit node form in Drupal 8?

In D7 I could achieve this by using this code

/**
 * Implements of hook_form_alter().
 */
function MYMODULE_form_alter(&$form, &$form_state, $form_id){

  // target a single form only
  if ($form_id == "form_id") {

    $form['html_markup'] = [
      '#markup' => views_embed_view('name_of_view','default'),
      '#weight' => 1
    ];
  }
}

I'm looking for a way how can it implemented in D8.

Any tips will be appreciated!


texts: Making a 'contains' type GET query over a REST API, with Services?

texts:
I've installed Services (and Services Views) so I can expose my drupal site as a RESTful API.

All my filters are working, but not the one that queries a taxonomy term array.

Here is an example JSO:

{
    name: "AngularJS",
    quad: "Solution Technology",
    desc: "AngularJS is an open-source web application framework, maintained by Google and community, that assists with creating single-page applications, one-page web applications that only require HTML, CSS, and JavaScript on the client side. Its goal is to augment web applications with model?view?controller (MVC) capability, in an effort to make both development and testing easier. (Source Wikipedia)",
    tid: "123",
    group: [
        "Web Application Framework",
        "User Interface"
    ]
}

I'm trying to query this with the string localhost/drupal/rest/technologies.json?group=Web%20Application%20Framework. Is this the right syntax?

Here are my settings:


texts: hybridauth module - redirect problems after connect

texts:
I am using Drupal 7 And the hybridauth module.

In the past - everything worked great, and new & existing users could connect with Facebook and with Twitter.

Now, I have a problem that no one is able to connect with facebook or twitter.

The "closing..." window is stuck for a long time (looks like refreshing itself all the time - like a loop). When I close this "closing.." window, it looks like the user has succeed to login, but I get a message in a repeat many times that says "You have already registered this identity". When this issue is happen - I usually see that the user is finally login - after this long process and many messages (not a clean connect). It's looks like the problem is mainly on the connection to facebook.

Does someone knows what is the problem, and how can I fix it?

dblog errors:

TYPE    hybridauth
DATE    Friday, March 28, 2014 - 18:16
USER    user name
LOCATION    http://www.example.com/hybridauth/window/Twitter?destination_error=home
REFERRER    http://www.example.com/hybridauth/window/Twitter?destination_error=home
MESSAGE Exception: User profile request failed! Twitter returned an error. in Hybrid_Providers_Twitter->getUserProfile() (line 77 of  /home5/mysite/public_html/sites/all/libraries/hybridauth/hybridauth/Hybrid/Providers/Twitter.php).
SEVERITY    error

Here is another db log, that looks fine here, but caused a stuck "closing.." window that refresh itself all the time:

TYPE    user
DATE    Friday, March 28, 2014 - 19:00
USER    user name
LOCATION    http://www.example.com/hybridauth/window/Facebook?destination_error=home&destination=home
REFERRER    http://www.example.com/
MESSAGE Session opened for hybridauth_Facebook_6003111111.
SEVERITY    notice


texts: Make a "Taxonomy Term" Appear in search field

texts:
What my requirement is to display taxonomy terms in search results when someone searches for anything related/similar to it.
For example: I have a taxonomy ABC, and articles 1,2,3,4 related to it. So when somebody searches ABC, along with article 1,2,3,4, ABC should also be visible there.
I suppose i would have to edit the .tpl.php file of 'search display' and also add the required fields in the taxonomy fields(like image and description) which are required by the articles when searched.Where and how can i add fields in taxonomy terms.


texts: I've created some Content type which contains few image field. It works fine for me, but I decided to add alt field. I've simply edit field and checked ALT Enable checkbox. Sadly it makes no difference. I know that ALT input field should appear below image input, but nothing is there. This same with other Image fields. I'm using drupal 7 and Seven theme for administration pages. I've also tried to check TITLE Enabled checkbox and it also not working. I Don't know what may cause this.


texts: Autocomplete search bar that links directly to node

texts:
I assume that this would be a common thing, however I cannot find a solution to this issue.

I am wanting to create a simple autocompleting search bar that shows results for a specific content type. When the user clicks on a suggestion, it links them directly to that node. I do not want to be redirected to a results page. I only want results to be shown in the auto completing drop down bit.

How can I achieve this?

Modules such as Search Autocomplete and Autocomplete Searchbox have linked me to a seperate results page. This is not what I want. Am I just missing something?


texts: Role can't see CKeditor options on Body field

texts:
Probably a simple setting somewhere, but I can't find it.

On a Drupal 8 site, I have an editor role, to edit/create blog posts. They can see the body field, but it shows as raw html. The wysiwyg CKEditor doesn't appear for them.

The editor role is assigned to the same CKeditor configuration profile as the Administrator. They have ability to to edit the field and the content type. It's just specifically the CKEditor editing that is unavailable to them.

When I look under role permissions, the only option I see relating to any wysiwyg is "Administer Imce File Manager" and toggling this on/off doesn't make a difference.

I've double-checked that the role can edit simple html all the way up to full advanced html.

thoughts?


texts: How do I show all "songs" that reference an "album" (for example)?

texts:
Suppose I have a content type (Song) which has a content reference field, referencing an Album node to which it belongs. When I view an album, I want to show a list of all songs which reference that album.
Can this be done?

I'd rather not use a taxonomy term. I've looked at the "Manage Display" screen for the Album content type, but I could not find any way to display the songs which reference it. I know that I can create a view which filters by album, but I want to display this information directly on the Album view screen, so when users click the album link, a list of all songs on that album will show up. Is this possible?


texts: How do I tell logging to ignore messages that I have seen?

texts: I've got a couple of log messages that are coming out every few minutes. I can't fix them as they are just part of the system. How do I tell watchdog to ignore them?


texts: When "drush updatedb" is executed, are scripts cached by OPCache invalidated?

texts:
For sites that have PHP OPCache enabled:

Does updating site using Drush require restarting the webserver to invalidate the scripts cached by OPCache?
Does Drupal core or Drush invalidate OPCache before running updates?
Is setting opcache.enable_cli to 0 a better strategy in this scenario?


texts: Change the default value of the node reference via hook_alter_form

texts:
field_userid is a user reference field with an autocomplete widget

i want to set the default value of this field, but the code below doesn't work

Does anyone can help me?

Thank you very much!

 function mymodule_form_node_form_alter(&$form, &$form_state, $form_id)
    {
        global $user;

        if($form['#node']->type=="article")
        {

            $form['#after_build'][]='mymodule_after_build';

        }
    }

    function mymodule_after_build($form, &$form_state)
    {
        global $user;

        $form['field_userid']['#default_value'][0]['uid']=$user->uid;

        return $form;
    }


texts: How to handle Custom Validation in inline entity Form?

texts: I'm using Drupal8's inline entity form and is having issue with writing custom validation. I found few links and wasn't helpful at all. Does anyone know how to handle this?


texts: Views Infinite Scroll pager conflicts with Comments pager

texts: After adding a block with Views Infinite Scroll pager under node pages, an unexpected pager appears under comments. Is there anything should I do to remove this pager?


texts:
I'm recently working on a view and i want to show the filters (two of them) as a menu. This means:
    That both filters can't be used at the same time (most important, a.k.a if one filter is already used and we click on the second, the first one is initiated),
    That the list of elements of each filter is shown when the mouse is on (less important)
    That the -All- should be replaced by the name of the filter (least important)

I have tried to look for it in the internet and find some answers that didn't work for me (here is the solution for an oldest version of drupal https://www.drupal.org/node/1111712)

Thank you ^^
Edit : I've developed a function to choose between both filters, but it's still not working

$testpriorite=0;
if((isset($form_state['input']['term_node_tid_depth_1']))&&(isset($form_state['input']['term_node_tid_depth']))){
    if(($form_state['input']['term_node_tid_depth_1']!="All")
      &&($form_state['input']['term_node_tid_depth']!="All")){
        if($testpriorite==1){
            $form_state['input']['term_node_tid_depth_1']="All";
        }elseif($testpriorite==2){
            $form_state['input']['term_node_tid_depth']="All";
        }
        $testpriorite=0;
    }elseif ($form_state['input']['term_node_tid_depth_1']!="All"){
        $testpriorite=1;
    }elseif ($form_state['input']['term_node_tid_depth']!="All"){
        $testpriorite=2;
    }

here term_node_tid_depth and term_node_tid_depth_1 are my two filters. Does someone have an idea ?

thanks again


texts: How to reorder the date in a view expose filter?

texts:
I have created a view with date expose filter. Currently filter is working fine but i need to reorder the day and month.

From month/day/year

To day/month/year


texts:
I'm new to drupal and when I looked at table {role_permission}, I found that permissions were stored as text string (e.g. "edit own page content"). But when I did a grep in drupal's folder, for some permissions they only appeared in *.test files (In those files, some users with those permissions are created). It seems that some permissions, like "edit own page content", are not used at all, otherwise they should appear somewhere else when they are checked.

Any insights on access control mechanism in drupal would be appreciated.

Thanks,
ZM


texts:
I want render my custom block in template file, but what I get is the block without going through the twig file.

theme_preprocess_page(&$variables) {

    $block =  \Drupal::service('plugin.manager.block')->createInstance('id_custom_block', array());
    $variables['custom_block'] = $block->build();

}

I Want render custom block, and different from a view block, this not work:

$block = \Drupal\block\Entity\Block::load('your_block_id');
$variables['block_output'] = \Drupal::entityTypeManager()
->getViewBuilder('block')
->view($block);

Am I doing something wrong?


texts: Autocomplete field where title is replaced with NID

texts:
I'm using Drupal 7 and I have made autocomplete function to be called on a field.
File my_module.module:
<?php

function my_module_menu() {

    $items = array();

    $items['/autocomplete'] = array(
        'title' => 'Autocomplete',
        'page callback' => 'companyAutocomplete',
        'access arguments' => array('autocomplete'),
        'type' => MENU_LOCAL_TASK,
        'weight' => 1,
        'file' => 'my_module.autocomplete.inc'
    );

    return $items;
}

File my_module.autocomplete.inc:
<?php

function companyAutocomplete($fieldInput) {

    $returnArray = array();

    $query = db_select('node', 'n')
        ->fields('n', array('nid', 'title'))
        ->condition('n.title', '%'.db_like($fieldInput).'%', 'LIKE')
        ->condition('n.type', 'company', '=')
        ->orderBy('n.title', 'ASC')
        ->range(0, 10);

    // print strtr((string) $query, $query->arguments());

    $results = $query->execute();

    foreach ($results as $result) {
        $returnArray[$result->title] = check_plain($result->title);
    }

    drupal_json_output($returnArray);
}

File template.php:
<?php

function my_theme_preprocess_field(&$vars) {

    if ($node = menu_get_object()) {

        if ($node->type == 'company') {

            if ($vars['element']['#field_name'] == 'field_company') {
                $company = entity_metadata_wrapper('node', $vars['items']['0']['#markup']);
                $vars['items']['0']['#markup'] = $company->label();
            }
        }
    }
}

and I have a field company (I use this field to enter NID):
$form['field_company'] = array(
    '#type' => 'textfield',
    '#default_value' => $defaultCompany,
    '#title' => 'Company',
    '#autocomplete_path' => '/autocomplete',
);

When I type something in field, autocomplete returns correct text value of the searched term and that is ok.
How can I modify companyAutocomplete() function or the field itself for autocomplete to works as it is, but to write NID instead title in $form['field_company']['und'][0]['value']?


texts: How to enable click sorting on count distinct column

texts:
I have a table view with a relationship to nodes associated with a taxonomy. Using aggregation, I have a column that lists a distinct count for the number of node references to the given taxonomy term. (see screen shot)

I was able to add a default sort by this count column, but I am unable to enable click sorting on the column. I'm not sure why one would work without the other... any suggestions?

For reference, here are some screen shots:


texts: Taxonomy vocabulary in breadcrumbs / url

texts:
I have a menu with some items that link to some views which filter content type associated with vocabulary terms.

Navigation

Menu ITEM -> views page vocabulary

Result :

my-site.com/vocabulary

(here it’s the vocabulary i added in view / PAGE SETTINGS / path so it is not automatically generated from vocabulary)

When i click on on one of the articles, i can see the full content.

It works fine.

Navigation :

Menu ITEM -> views page vocabulary -> article

Result :

my-site.com/title-of-article

My question is related to breadcrumb.

The native breadcrumb of Drupal 8 doesn’t work properly. I’ve made a lot of search and discover that breadcrumb is not perfect in Drupal 8.

So I have tested 2 modules : Menu Breadcrumb and Easy Breadcrumb

Then, i can now display the Breadcrumb but i don’t see the taxonomy vocabulary in it.

I have :

home / Title of article

I would like to have

home / vocabulary / Title of article

or

home / (path view) / Title of article

I’ve sen other modules but they are not ported to D8 for now :

Taxonomy Breadcrumb (No further development)
Hansel          breadcrumbs (not D8)

How can I handle this ? Do I have to create a custom module to handle vocabulary terms in breadcrumb and in url ?


texts:
I have a form adding an item to the basket in the form of a table n x m where
n and m are taxonomy terms of two different taxonomies ('type of the insert' and 'insert size').

In each cell the user can enter the number of items, with the n-th 'type of the insert' and m-th 'size'.

Form I create myself in the template-based taxonomy vocabularies. How can I add products to cart programmatically?


texts: Is there a way to find out how many registered users logged in a given time period?

texts: I am working on KPIs for my site and there are a few numbers I want to track. One of them is how many registered users actually logged in every month. Is there a way to get this number?


texts: Automatic way to delete users with no content

texts:
I have created an artist registry that needs help deleting users that have not created a content type node "Artist Page".

I can find ways to delete users that are inactive, but in this case, some users might be inactive for years if nothing on their page has changed.

Preferably, I would first like to send a reminder email notice to users without an "Artist Page". When a user registers within the site they are instantly directed to fill out their artist page, but some users are only registering and not filling out their page, and of course, some registration spam is getting through.

Once an email is sent,  and if no content is provided after a certain amount of time, I would like to delete them from the system to keep the site as clean as possible.

Any help would be greatly appreciated.


texts:
Standard Drupal comes with a "promote to front page" when creating new content. But I want know how to promote, let's say News flow to the block located to the right?

As far as I know there is no "url" for blocks so I can't really use view to assign my news flow to the blocks url. So how do I do this the easiest way?


texts:
I would to know if I need to run Default group AND migrate_drupal_6 group on every migration ?
Or if I can only use one or other group ?

Because I notice that "d6_user_role" migration import users, but "upgrade_d6_user_role" not.

Then do I need to run "d7_" ones for a Drupal 6 to 8 migration ?

Basic asking, but save timer.

EDIT: I need to run migrate-ugrade twice to get the 2 groups created, 1st create upgrade_d6 and 2nd create d6_ group ;actually, I get differences between migrations as:

"d6_user_role" migrate all roles
"upgrade_d6_user_role" migrate    only 1 of 9
"upgrade_d6_files" migrate 1448 files of 1452
"d6_files" do the    same but currently fail all files,so migrate
0/1452


texts: Custom ckeditor.styles.js file with WYSIWYG module

texts:
I am trying to customize the "Font style" dropdown in CKeditor through the WYSIWYG module, but I see no way to specify a path for ckeditor.styles.js in the wysiwyg module's profile editor.

Refer to this post for futher information - it says there should be a way to specify a location for that file.


texts: How to hide the "help-block" on an Image field in the Comment Form

texts:
I have added an image field to the comments.

This allows to my visitors to add images with a comment.

But I have annoying "help-block" for the image field in the form of adding a comment.

How to gracefully to remove this stuff?


texts: Why does this code work for the current term but not the parent term?

texts:
This code below displays the current taxonomy term on a taxonomy term page

$current = taxonomy_term_load(arg(2)); ?>
if ($current): ?>
echo $current->name; ?>
endif; ?>

The code below displays the error: "Notice: Trying to get property of non-object in eval() (line 9 of...)  Line 9 is "echo $parent->name;"

$parent = taxonomy_get_parents($current->tid);
if ($parent){
echo $parent->name;
}?>

I'm really confused as to why the first set of code works but the 2nd doesn't? "print_r($parent);" displays the info below, so the data is there.

Array ( [3218] => stdClass Object ( [tid] => 3218 [vid] => 12 [name] => NAME OF TAXONOMY TERM [description] => This is the description area [format] => full_html [weight] => 0 [vocabulary_machine_name] => mfr_model [field_displayed_view] => Array ( [und] => Array ( [0] => Array ( [vname] => final_term_pages|testing [vargs] => ) ) ) [metatags] => Array ( [und] => Array ( [title] => Array ( [value] => This is the meta page title ) [description] => Array ( [value] => This is the meta description ) ) ) ) )


texts: Display Entity Reference field twice, with different display modes

texts:
I have a content type (Type A) that has an Entity Reference field to another content type (Type B).

Type B has 3 fields and 2 display modes. Display A shows two of the fields, Display B shows the other field.

In the display settings for Type A, the display mode for the Type B entity is set to Display 1.

On the template for Type A, I can use {{ content.field_type_b }} and the two fields are shown.

Now, I want to be able to output the field again, but as Display 2, in a different part of the template.

In a pseudo twig code way, I'd imagine something like {{ content.field_type_b|display_mode('display_2') }}

I have heard suggestions for Display Suite, but I tried this and it seems whilst you can clone a field, there is no option to render it as an entity with a display mode.

I also found Twig Tweak, which I think might work, however, the documentation is beyond terrible and I cannot see how I'd actually use it (the cheat sheet lacks all manner of help).

If this is not possible in Twig, could this be achieved in a hook? Bearing in mind, the field I want to render in Display 2, is a nicely rendered map, so I don't want to simply get the field value, it has to be using the display mode.


texts: how to display the actual taxonomy term (last part of breadcrumb) related to contents in View not the "parent terms"?

texts:
I have a vocabulary like this:

Parent 1
    Child 1
    Child 2
    Child 3
Parent 2
    Child 1
    Child 2

& I've made a view with a contextual filter for "Taxonomy term: Term ID"

when I add the parent 1 term ID in the URL the result would be the contents related to "child 1" "child 2" and "child 3"

Now when I add the "Taxonomy term: Name" field in View the "Parent 1" is displayed as term name of all result item BUT i need to render "child 1" term for contents related to child 1, "term 2" term for contents related to child 2 and so on...

would you please show me a solution?


texts: How to prevent invalid config from being saved?

texts:
I want the site email address to be located at the same domain as the website. If an email address with different domain is provided such value should not be saved into config.

I have taken care of this in UI but what about if some module sets this value(via custom form or programmatically) that I have no control over? How can I prevent it from making the change?

I asked on irc but it turned out the config has no constraint or validation mechanism other than the data type/format.

Am I missing something or there is really no way of "protecting" the config?

In \Drupal\Core\Config\Config::save I see there is an event dispatched but it is only after the value has already been saved into storage.


texts: PHP snippet: why comparing the term id with a number keeps getting the wrong result?

texts:
I have a Drupal 7 site. I have this taxonomy field that I get printed out using tokens and Display Suite Module.

So, if I create a "code field" at /admin/structure/ds/fields, I can type: [node:field-suscriptor-estado1:tid] in order to get the term id of that particular node. In fact that outputs correctly the term id. It outputs a number.
field-suscriptor-estado1 is the field of type term reference.

If I add var_dump($tidNum); I get int(0).

In order to show some differences between different terms, I try to compare the term ID to the one that I've got stored in database, and if they do match, it shows the result in one color. If they don't, the color is different.

As I know that the only terms that I will ever get there are 867 and 870 ("abierto" and "cerrado") I've done a quick if statement in order to achieve that:

<?php
  $tid = "[node:field-suscriptor-estado1:tid]"; //I assign the term id to a variable
  echo $tid; // I tested to see if I get it printed out using php, and it does print it: 870
  $tidNum = (int)$tid; // I transform the string variable to a number

  //now, if the number that the variable $tidNum has is 869 print the field with the class suscriptor-estado-abierto, else, print it with the class suscriptor-estado-cerrado.

  if ($tidNum == 869) {
    echo "
[node:field_suscriptor_estado1]
";
    } else {
    echo "
[node:field_suscriptor_estado1]
";
    }
?>

The only differences are the css classes that I assign to the field. That way, if it is "cerrado" (closed) it's in red and if it is "abierto" (open) the color is green.

My question is, why if the number that I do get is 870, it keeps printing it out as if the did match? (with suscriptor-estado-abierto class).

I've tried different ways: ($tidNum == 869), ($tidNum === 869), and ($tidNum != 869). This last one changing the color rules, naturally.

The result is the same. I've tried also with a new if, asking for $tidNum == 870.  The result is the same.

Why it isn't working?

If I try this, for the sake of testing, it outputs as it should:

  $tid = "870";
  echo $tid;
  $tidNum = (int)$tid;
  if ($tidNum == 869) {
    echo "abierto";
    } else {
    echo "cerrado"; // it prints out cerrado
}


texts: Webform/SwiftMailer - TypeError in encodeString() - must be of the type string, array given

texts:
I got into an issue while using a combination of SwiftMailer and Webform on Drupal 9. I found nothing helpfull while Googling and it took me a few days to figure out the issue. Hence I am sharing my findings with you.
My context:

Drupal 9.1.3
Webform 6.0.2 - with an Email Notification Handler
MailSystem 8.x-4.3 - Module: Webform / Formatter: Swift Mailer /
Sender: Swift Mailer
Swift Mailer 8.x-2.0 - set up to send SMTP emails

The problem:
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Swift_AddressEncoder_IdnAddressEncoder::encodeString() must be of the type string, array given, called in /home/www/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php on line 378 in Swift_AddressEncoder_IdnAddressEncoder->encodeString() (line 32 of vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/IdnAddressEncoder.php).

How the problem manifested:

the error above was displayed on the website's footer
none of the AJAX driven features of the website didn't work - the ones from the admin interface, nor the ones in the front-end


texts: How to assign user ranks based on their userpoints?

texts:
I am using the User Points and User points Nodes and Comments modules to calculate user points when they publish an articles or comment on a node.

On these points I want to assign some rank to the user. Like for example

    Upto 100 – Junior Member
    100 to 300 – Senior Member
    300 + - Premier Member

Can someone give me some idea about this?


texts: How do I allow a free product into a cart, but only if cart net value is above $10?

texts:
I'm interested in running a promotion ...

I'd like to make a product free if the customer's cart total is $10.

I was able to do that with this module: http://drupal.org/project/uc_discounts_alt

Everything is working great, but I don't want my customer to be able to add the product to their cart unless they are buying $10 worth of regular products.

The products I'm giving away could be placed in another ubercart class, but I can't find a module that will allow me to prevent the node from being sold unless the cart total is $10 or more.

Any ideas or help would be greatly appreciated.

I've already explored the "free" checkout options; I'm really simply looking how to make a product not sellable unless the cart total has a minimum of $10.


texts:
I want to get triggering_element element on form_alter after form rebuild, Also I know that this could be used on submit handler on Ajax controller to findout which element cause form submit or Ajax triggered.

So how can I get triggering_element after Ajax call or form submissions?


texts: Is there a module similar to the Tiered Taxonomy Block module for Drupal 7?

texts:
I have two taxonomies (tags, and group), and one content type (article). I want to show tags which have content in page of group/123.

I found Tiered Taxonomy Block which has similar functionality, but it is only for Drupal 6, at the moment.

What is a similar module for Drupal 7?


texts: Create map that show user Location and last user's post

texts:
I don't know my question is cheap or good !:(

I want to create a map that shows on users location and last post like Azadnegar's map or Drupal.org front page.
I know I should use openLayers, CCK, views but I can't build as well as Azadnegar!
I want to know how create map like its map, I mean how can I config our modules.
in this site get user location in registration form in list box,how create like it?

what map her use?How create views?or ...

please explain whit detail !


texts:
I am using the View in my project with DELETE button (Configure field: Bulk operations: Content).

View has some important details,

How to disable the DELETE button except the admin?


texts: Add new referenced entity if none was found using Inline Entity Form autocomplete

texts:
Is there any module or other solution for Drupal 7, that would extend Inline Entity Form to offer creation of new entity if none was found using autocomplete widget? Yes, I can cancel the form and create new entity, but this isn't straightforward. I also found some discussions about this, but no solution integrated with IEF:

https://www.drupal.org/project/entityreference_autocreate
https://www.drupal.org/node/1540944

Does anything like this exist?


texts: Drush cc gives only two options even when I am in root folder

texts:
I am working with drupal 8, MAMP version 3.5, and drush version 8.1.3. I have installed drush globally and when I enter drush st it gives me complete information and shows that drush is installed but when I run drush cc, it gives me only two options

cancel
drush

whereas, it is suppose to give me many options. I am in a root folder of the site I am working on .i.e. /Applications/MAMP/htdocs/mysites/mysite. My OS is OSX on macbook pro, just in case if this is mac specific issue.

Done with this step as well:

sudo ln -s /Applications/MAMP/tmp/mysql /var/mysql

Not sure what else to look into, can you anyone please guide? I am new to drush, terminal and mac


texts: Unable to retrieve uploaded file in submit handler

texts:
I'm creating a custom form with a file upload field that will have its contents read, processed then sent to an external API. The problem is whenever I upload the file the field for it appears to be empty in the submit handler and I cannot see why.

In this example I'm using it as an unmanaged file as I only need to process it then remove it but I have tried it as a managed file which does upload (I can see it in the directory) and has the file added to the file_managed database table. I'm not sure where unmanaged file are meant to go to check for their upload.

public function buildForm(array $form, FormStateInterface $form_state) {
    $form = [
      '#attributes' => ['enctype' => 'multipart/form-data'],
    ];

    $form['file_upload_details'] = [
      '#markup' => "<strong>" . $this->t('The KML File') . "</strong>",
    ];

    $form['my_file'] = [
      '#type' => 'file',
      '#description' => $this->t('KML format only'),
      '#upload_location' => 'public://my_files/',
      '#upload_validators' => [
        'file_validate_extensions' => ['kml'],
      ],
    ];

    $form_build = parent::buildForm($form, $form_state);

    return $form_build;
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    $messenger = parent::messenger();

var_dump(
  $form_state->getStorage(), // Empty array
  $form_state->getValue('my_file') // Empty string
);
  }


texts:
I'm working on a small D8 site. When turning the option "Aggregate CSS files" (admin/config/development/performance) on localhost, everything works fine. However, doing so when on my test server completely breaks the site presentation, both on the front (public pages) and back-end (admin).

It appears that when this option is on, the URL for the aggregated CSS is incomplete: the filename is not present, as well as most of the path, actually. Which means I have something like:

<link rel="stylesheet" href="/dpfolder/?okfo8d" media="all" />
<link rel="stylesheet" href="/dpfolder/?okfo8d" media="all" />

(the site lives in "dpfolder", although it's temporary.)

This happens with both the admin theme (seven) and the public theme (a custom theme based on Classy).

And it only happens when the option "aggregate" is ON. When it's OFF, everything displays fine (but then the CSS files are included via @import rules in a style element, and not via a link element like above).

Any idea what's causing this?


texts:
For some reason I cannot get this to work. Here is what I have in my custom node template which is named node--news-feed.tpl.php..

<?php print render($content['field_company']); ?>

This should render out the taxonomy terms in that field, right?


texts:
I have a custom block code this block return a specific taxonomy in drop down list like this

function manufacturer_country_options() {
  $options = db_query("SELECT name,tid FROM {taxonomy_term_data} WHERE
    vid = 35 ");
  $rows[''] = t('-- Any --');
  foreach ($options as $row) {
    $rows[$row->tid] = $row->name;
  }
  return $rows;
}

but this function does not give me the translation of vocabulary how i can fix it to return the translation


texts: How to create an article with "show on demand" part of the text of the article?

texts:
What I am trying to do is like in the picture.
So I would have an article of same text of multiple language. When I click on the Flag/text link on top of the article, it should show particular part of the text of that language selected. All other texts should be hidden. Is that something easily achievable? Can anyone suggest how to go with it please?


texts: Autocomplete field not using Entity Reference list settings

texts:
I'm using an Entity Reference field set to Views: Filter by an entity reference view. That works. I can choose my view: maps_by_project_season – Entity Reference.

I've chosen 3 fields in the view, and added them all to Format: Entity Reference list via settings, and I see all 3, separated by -, in the preview.

But not in the autocomplete field. That only shows the title. What am I missing?


texts:
How can I have multiple values trigger the Form API's #states?

Say for example, I wanted this field to be visible not only if the value is 5 (currently works below), but wanted to make the field visible if the the values are 3, 4 or 5.

'#states' => array(
    'visible' => array(
       ':input[name="field_star_rating"]' => array('value' => t('5')),
    ),
),

As a note, I tried the following and it does not work.  It only works if the value is '4'

'#states' => array(
    'visible' => array(
        ':input[name="field_star_rating"]' => array('value' => t('5')),
        ':input[name="field_star_rating"]' => array('value' => t('4')),
    ),
),

This also does not work, it too only works if the value is '4':

'#states' => array(
    'visible' => array(
        ':input[name="field_star_rating"]' => array('value' => t('5'), 'value' => t('4')),
    ),
),


texts: How to get the original term name from the translation of a term without knowing the tid?

texts:
I have a vocabulary which has the option Localize. Terms are common for all languages, but their name and description may be localized. set for its multilingual settings.

I have 2 languages on the site. One is English and 2nd is Dutch.
I have a term name English term and its translation in dutch is Dutch term.

So is it possible programmatically to get the original term name (English term) from the translated term name (Dutch term) without knowing the tid?

In the question "How to get the translated term name by tid?" the tid is known but here I mentioned that without knowing the tid. So this is a different question.

Any suggestions?


texts: Admins that only control a subset of users

texts:
I am creating a page where users pay to create and edit their custom content.

These clients need to use multiple accounts with certain edit-rights - so they need their own people-management.

These are my requirements in that respect:

Each client-admin belongs to an organization that can have multiple members
Each organizatin "owns" certain content
Each client-user can edit content of his organization but only if the client-admin has granted him these rights

Is there a way that I can create admins that only control a subset of users?

(I found the https://drupal.org/project/administerusersbyrole module, but with that I would need a new role for each client. Is that a good solution? )


texts: How to add contextual links to the main content block?

texts: The main content block has no contextual links. I believe this is related to _block_get_renderable_array but I'm not really sure. I'm using Custom Contextual Links module to add contextual links to blocks, but of course it doesn't work with system-main (the main content block).


texts: Will I loose this content or the content will be saved?

texts: I'm new in drupal. I have one site that is running on drupal version 7 and now needs to be upgraded. My question is: I have big content in this site, after the upgrade will I loose this content or the content will be saved?


texts: Clarification for Pathlogic settings needed

texts:
I have installed Pathlogic but can't get it working.

I want to have the LIVE url appended to localhost for images in basic page content items. Format is Full HTML, using IMCE

Configuration is as follows on:

admin/config/content/pathologic

Path relative to server root (/foo/bar) is selected

In the box that says:

All base paths for this site, I added:

/sites/xuzo.dd/files/

When adding content images on the live site the path looks like this:

/testing/sites/default/files/content_images/left.png

When adding content images on the localhost site the path looks like this

/sites/xuzo.dd/files/content_images/left.png

I exported the database from live site to local host, still images not showing and wrong image URL...


texts:
I am using this code to make the user_profile_form available on my user-profile.tpl.php so the user profile filed can be edited directly from the sure page.

function parce_preprocess_user_profile(&$variables) {
  $variables['user_edit']  = drupal_get_form('user_profile_form', menu_get_object('user'));
}

Then, I can correctly print them individually using this code:

<?php print drupal_render($user_edit['account']['mail']); ?>

It works fine, but the problem is that the <form> tag doesn't appear on the page, and the form doesn't submit. When I add it manually in the template page, it works, but I was wondering how to get Drupal to insert these tags automatically.

I tried something like this (out of pure guess):

function parce_theme($existing, $type, $theme, $path){
  return array(
    'user_profile_form' => array(
      'render element' => 'profile_edit',
      'template' => 'user-profile',
    ),
  );
}

It doesn't work. Am I doing anything wrong?


texts: View Contextual Filter with external Database - Drupal 7

texts:
I've created a custom module to display in views an external database.
Everything is working fine and the data are displayed right.

The problem start when I want to use contextual filter.

-I create a views block to pull data from my external database

-I add a new Contextual filter picking up the field which I want to filter (in my case "city").

First I get this message: "city
This display does not have a source for contextual filters, so no contextual filter value will be available unless you select 'Provide default'."
I select "taxonomy term Id from Url", I checked "Load default filter from node page, that's good for related taxonomy blocks"
I checked my vocabulary which contain the terms.

If I try in "preview with contextual filter" to query with "Rome" (for example) I get all the record with Rome.

But when I attach this view block with a node wich has a taxonomy term "Rome" the record doesn't get filtered.

I've also tried "Raw value from url" to get the term from the url. Also in this way doesn't work.

When I make the same operation above using instead of external database some drupal nodes everything is working fine.

I guess the problem could be because the external database cannot comunicate with a drupal database at the same time.
Maybe there is some php code to use to solve the problem ?

Thanks for your help


texts: How to add an article to a page automatically

texts:
What I want to do is to add the title and the body of an article I create on my homepage just as you would do it for a news.
I've been trying to make this work but I can't find a way to do it without having to remember the path and then manually creating a block.


texts: Are absolute paths allowed in info files?

texts:
I'm writing a .info file for a module, and I want to include a script which has been installed in /sites/all/libraries:

So I have included the line below in my .info file:

scripts[] = /sites/all/libraries/zeroclipboard-2.2.0/dist/ZeroClipboard.js

However, with or without the leading slash on this path, I always get the same result: Drupal treats this as relative to the module directory and tries and fails to load

/sites/all/modules/custom/clipboard//sites/all/libraries/zeroclipboard-2.2.0/dist/ZeroClipboard.js?nsnrjh

So maybe I've answered my own question, but I can't find any definitive answer to this in the Drupal docs?

Thanks all,

MB


texts: Is there a module that changes "node" links to "alias" links?

texts:
I use global redirect, pathauto and redirect modules.

Everything is fine, except one situation:
I couldn't find the anwser, maybe it is very easy problem..
I can give links to nodes by using "link" "redirection" modules.
I creating new field with the type of Link.
When i select links from the lists, i can link to any node by using "fields".

But i want to give links to nodes in "body" of "node".
When i write

click here

In node content, the links is written with "node" word.
But i want to see this link in page with its alias, like this:

click here

Is it possible?
Thank you for help.


texts: With the core testing, how do I set a database variable?

texts:
I am trying to establish a test suite for my project using the core testing module. But I can't get past such a trivial thing as setting a database variable.

A lot of tutorials on the web tell you to use $this->drupalVariableSet - e.g.:

public function setUp() {
  parent::setUp(array('my_module'));
  $this->drupalVariableSet('my_module_var', 42);
}

This throws "Call to undefined method Mymoduletest::drupalVariableSet()" - so it looks like it has been depreciated at some point.

Using variable_set, e.g.:

public function setUp() {
  parent::setUp(array('my_module'));
  variable_set('my_module_var', 42);
}

does not produce an error, but the setting has no effect (i.e. the variable has its default value when it is used in one of the my test cases.

Any help will be appreciated.


texts: How can the Feeds module be made to retrieve all items or items a few years old?

texts:
I am creating a planet style aggregation website and when I add a feed, the Feeds module limits the age of the articles to those less than 3 months or so. But when I use the aggregator module all the articles from the feed are included.

This feature in Feeds appears to be hard wired, as I suspect the aggregator module depends on Feeds too. Is there a way to patch feeds to remove this limitation?


texts:
I'm learning Drupal and I'm trying to create a field where I can upload 2 images and let one face into the other while I mouse over/ hover / rollover it. Then I eventually plan to make it into a views like one in Zappos where the user can see alternate views on mouse over.

I've looked up the other thread and found the Rollover filter on Drupal but I still don't know how to make that work. I need it as a field of a node so that I can display a view of all the related nodes.


texts:
I have a table structure for fee details as

fid
name
description
currency
fee
instalments
created

This fee schedule has N no of instalments and storing in a cross ref table as

iid
fid
instalment_no
amount
payable_by

This fee schedule has associated students and are storing in a cross ref table as

fid
uid

I need to show the details of a fee schedule to end user with all installments and students. Is this possible to get this fee detail page using views 3.

Please help me to write the SQL to fetch fee details with students and fee instalments.

Thanks in advance for your help.

EDIT

One of my friend suggested me to create three displays in views each showing result from each table i.e. first display to show the fee details, second fee instalments and third to show the fee students. Then in page display all three views by using the functions views_get_view. Thanks Inian :)

While doing the way Inian suggested, I found attachment as a display type and that solved my problem and I don't have to write any custom code now.

Umar


texts: How to use Biblio Inline references in D7?

texts:
I'm working on an online handbook with Drupal 7. For managing the high number of bibliography references I am using the Bibliography Module. In the documentation I found the following explanation for adding biblio citations inline:

Adding Biblio Citations Inline
First, the Biblio module references filter has to be enabled. This is under:
Home » Administration » Configuration » Content authoring » Text formats
Then you can use the syntax described there to add references to biblio resources within the text of other content:

<cite><bib> or [bib]
Use <bib>citekey</bib> or [bib]citebkey[/bib] to insert automatically numbered references. </cite>

The cite key is available under Identifiers in the bibliographic reference.

https://groups.drupal.org/node/2829
I can't find the path to the Text formats settings and the Identifiers option. So how can I add inline references to Biblio content at the end of my handbook pages?
Any suggestions would be much appreciated.


texts: Adding taxonomy filter at the top of image gallery

texts:
I've spent some time trying to discover how can i add taxonomy filter at the top of the gallery view in Drupal 7. I've created View called Gallery which contains of images,title and author. In content type I've declared that it is a term reference to Gallery type taxonomy. My purpose is to allow user to sort the image gallery by tag, simple example would be animal gallery, for example:

'all' 'pigs' 'dogs' 'cats'
'image' 'image' 'image'
'title' 'title' 'title'
'user'  'user'  'user'

So far I've created this View of images,title and author, I've no idea how to include taxonomy tags. I hope this explanation is understandable. Any help would be appreciated.


texts: Entity form presents all taxonomy terms instead of vocabulary

texts:
I create entity form and add entity reference taxonomy field, set it as select and specify options, but i get all terms instead of one vocabulary terms.

Any idea how to make it works?

here some code.

$taxonomyStorage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
$voc             = $taxonomyStorage->loadTree("my_vocabulary");

$array = [];

foreach ($terms as $term) {
    $array[] = [
        'tid' => $term->tid,
        'name' => $term->name
    ];
}

$fields['voc_type'] = BaseFieldDefinition::create('entity_reference')
        ->setLabel(t('Voc Type'))
        ->setDescription(t('Voc tag'))
        ->setSetting('target_type', 'taxonomy_term')
        ->setDisplayOptions('form', [
            'type'    => 'select',
            'options' => $array,
            'weight'  => -6,
        ])
        ->setDisplayConfigurable('form', true);