texts: Custom region in theme not on front page?

texts:
This is probably (hopefully) a simple question, but I can't figure it out: I'm trying to customize a theme to add a div/region for a "banner" that will display the title of the page on each page...except for the front page. The front page will have a similar "banner" but with different content, more like a promotional thing.

I thought the simplest way to include the banner with the title was simply to move the title rendering in the page.tpl.php:

      <?php print render($title_prefix); ?>
      <?php if ($title): ?>

          <?php print $title; ?>

      <?php endif; ?>
      <?php print render($title_suffix); ?>

This works fine, but then I will get it on the front page as well, and there I want it replaced by a similar banner but with custom content, preferably inserted by a custom block I will create.

How do I do this separately for the home/front page?


texts: Mismatched entity and/or field definitions for comment field

texts:
I have been receiving this message

  ENTITY/FIELD DEFINITIONS Mismatched entity and/or field definitions
  The following changes were detected in the entity type and field
  definitions. Comment The Entity type field needs to be updated. The
  Comment field name field needs to be updated.

I have tried quite a lot of things including running entup (apparently depreciated) and adding some lines on entity update to index.php. Nothing has worked, I don't really use comments on my site, but would like to resolve it, any ideas?


texts: How to make a Shortcuts menu that open with new window or tab?

texts: In Drupal 7, I added the "IMCE" url(www.mydomain.com/imce) into the Shortcuts menu for user to upload file. How to make this menu to open in a new window or tab?


texts: Javascript errors caused by  elements being wrapped inside a  tag

texts:
I noticed that my site footer and a lot of <script> elements are wrapped inside a <strong> tag.
This is causing a lot of JS errors of the type:

Uncaught TypeError: Cannot read property 'permissionsHash' of undefined
Uncaught TypeError: Cannot set property 'StateModel' of undefined
Uncaught TypeError: Cannot set property 'AuralView' of undefined

How can I fix that?


texts: drupal 8.1 blocks config choices different from D8

texts:
I did a migration in Nov/2015 of my D6 to D8 and the blocks look like this.

Then I repeated the migration of my D6 to D8 on May/2016 and my blocks
look like this.

They are different.

Where is the documentation for the configuration of the block visibility

Thanks,


texts: How to use a RedirectResponse with a # (hash)?

texts:
I have this code:

$event->setResponse(new RedirectResponse(base_path().'mypage#actions_clicker'));

It redirects to /mypage, but it doesn not include the #actions_clicker part. How do I make Drupal not loose the hash / # part?


texts:
My aim is to trigger a rule via Ajax.

Until now I create a custom module called "iscrizione"

Here my iscrizione.rules.inc

function iscrizione_rules_event_info() {
$items = array();

$items['iscrizione_evento'] = array(
  'label' => 'Iscrizione all\'evento',
  'group' => t('Links'),
  'variables' => array(
    'path' => array(
      'type' => 'array',
      'label' => t('Path accessed'),
      'description' => t('The path which has just been accessed.'),
    ),
    'account' => array(
      'type' => 'user',
      'label' => t('updated user'),
    ),
  ),
);

return $items;
}

Here my iscrizione.module

function iscrizione_menu() {
$items = array();

$items['conferma/%'] = array(
'title' => 'Conferma Iscrizione',
'page callback' => 'iscrizione_evento',
'page arguments' => array(1),
'access arguments' => array('access content'),
);

return $items;
}

function iscrizione_evento($arg) {
echo $arg;
// rules_invoke_component('rules_stampa_messaggio', $arg);
rules_invoke_event('rules_iscrizione_iscrizione_evento', $arg);
}

I tried both functions (invoke event and component), but if I type the url I can see only the $arg printed.

No action was fired (as actions I put "
Show a message on the site" and a "Create entity")

Any help?


texts: Alter a view to show the first N results

texts:
I created a view via the view user interface. From a custom module, I want alter the view for display the n firsts results depending of some user parameters.

I don't find how I can do that with views alter hook functions. For example, via the pre execute view alter hook, I can get the query substructure. How can I configure this structure for not display all results by display only the first N  results?

The "limit" value define the value in the current page with the current "level" of pager (10 results of the 27 results are displayed in pager 1, 10 results of the 27 results are displayed in pager 2 and 7 results of the 27 results are displayed in pager 3). The "limit" doesn't define the total number o, f the result query.

Thanks to Kevin answer, I tried this code.

function mycustommodule_views_query_alter(ViewExecutable $view, \Drupal\views\Plugin\views\query\QueryPluginBase $query){

    if($views->id() == "mycustomview"){
        $view->query->setLimit(7);
        $view->query->setOffset(5);
        $view->save();

        // I try also ..
        // $query->setLimit(7);
        // $query->setOffset(5);
    }
}

My view in the view page doesn't change and displays 10 results (number total of nodes). How can I set Limit and/or Offset and 'save' the change from the hook view query alter?

After Rémy's answer, I tried this code.

function mymodule_views_query_alter(\Drupal\views\ViewExecutable $view, \Drupal\views\Plugin\views\query\QueryPluginBase $query){

    if($views->id() == "mycustomview"){
        $query->setLimit(3);
        ksm("Hey ! I pass here !"); // log function
    }
}

in drupal/modules/custom/mymodule/mymodule.module file

OR

in in drupal/modules/custom/mymodule/mymodule.views_execute.inc file

and I clear caches with "drush cr"

=> My view page display my log ("Hey ! I pass here !"), BUT, my view always display ALL result :/ Its crazy ! x)


texts: Is there a variable that keeps track of which pages are enabled or disabled in Page Manager?

texts: I'm using the Features module and I'm tired of manually enabling/disabling pages (user_edit, user_view, etc.)  Is there a variable that I can add to Strongarm to control this in code?


texts: Letting anonymous users vote in a poll when using Varnish

texts:
I have a poll on my front page that I want users to be able to vote on, but anonymous users always just see the results and are never able to vote. I've been trying just about everything I can think of to fix this and nothing works.

I'll start by saying that I can access my web server directly through an alternate port. When I do this I see the poll when I'm not logged in; so I know that anonymous users can vote.

I've tried using ESI and the Drupal 7 ESI module. I got it set up and working so that the poll block is being loaded via an ESI tag (obviously accessing it directly through the alternate port stopped working when I did this since browsers don't parse ESI tags). No dice.

I tried using the AJAX Blocks module, I set a delay on loading the block just so I could visibly make sure the block was loading via AJAX, it was and it was still just displaying the results.

I tried voting from the same IP address using the alternate port, thinking that since someone has voted going through Varnish before the server wont allow it again, but I can vote twice from the same IP address through the alternate port.

I tried logging into the server via ssh and using Links to view the site, thinking that maybe it's the local IP address that is making the web server serve the results page for some other reason, but when I use Links I can see the voting form.

Clearly there's something that's causing Drupal to serve the results instead of the form when Varnish requests the page, but what is it?!?


texts: How to disable/enable cache of all views programmatically?

texts:
Case: I have over 50 views in my site and for performance improvement all were enabled to cache data during their implementation.

Now I want to disable cache for all views at once for some reason (make it more realtime).

Please help.


texts: change FILTER CRITERIA for display (in views)

texts:
I want to have different filter criteria for one display in my views. I added it and when i hit "Update preview", the data shows up as expected in the bottom area of my views window. But then, when I surf to the url or when I hit the link specified at Path, I get data that appears without that filter applied. I have hit the save button on top, too. What else am I missing?

edit 1
Also, I have realized that my second display also shows the title of my first display but I can reach it on the alternate path url...

edit 2
see screenshot in better resolution at: http://www.tiikoni.com/tis/view/?id=5c2a5fe
screenshot: On the left screen, you can see the view settings and on the right screen, in the April 2014 & May 2014 sections, you can clearly see that the filter Content: Title (contains Brunch) doesn't get recognized


texts: Drupal 7 - How to loop foreach in multiple value in custom view

texts:
I'm customizing a view (in views-view--myview.tpl.php) based on a node which has a field with multiple value (field_galerie_image).

I'm trying to list in a foreach loop that particular field, and I am wondering how to write it down.

In the following code, I can access a value with $vue->_field_data["nid"]["entity"]->field_galerie_image['und'][0]["filename"]; but I need to loop through it.

$vue->_field_data["nid"]["entity"]->field_galerie_image['und'][1]["filename"];
$vue->_field_data["nid"]["entity"]->field_galerie_image['und'][2]["filename"];

The code I am using is the following one.

<?php foreach ($view->result as $id => $vue): ?>
  <?php if($vue): ?>
    <?php print $vue->nid; ?>
    <?php print $vue->node_title; ?>

    <?php print $vue->_field_data["nid"]["entity"]->field_galerie_image['und'][0]["filename"]; ?>
  <?php endif; ?>
<?php endforeach; ?>


texts: How to check a checkbox by default in forms api

texts:
I wonder how I can check a checkbox by default? Is #default_value the wrong attribute?

 $form['ios'] = array(
            '#title' => t(''),
            '#type' => 'checkboxes',
            '#description' => t(''),
            '#options' => $options,
            '#default_value' => 'checked' // this is not working

        );

Thanks a lot!


texts: is there a way to find how many users unsubscribed from my Simplenews newsletter at my Drupal-7 website? And, if yes, can I detect from which particular newsletter did the user unsubscribe from?


texts: How to get an editable cart at checkout with Drupal Commerce?

texts:
I always used Commerce Kickstart as a starting point for making e-commerce stores, but this time I opted to go with pure drupal + commerce modules.

One problem I have is that the cart view I get when I enter the checkout process is non-editable: it's just the list of items. The view used by the checkout is "Shopping cart form (Commerce Order)", and the cart uses Shopping cart summary (Commerce Order). The latter has "remove" button in rows and an "update cart " link. Actually, I was able to replicate the elements of the formerin tha latter, save for the update" cart link.

I can get the one I am used to by going to view cart, but I do not get this one on chceckout. I tried to change settings at admin/commerce/config/checkout/form/pane/cart_content, but I can't  get the desired result.

Any Ideas?


texts: how to find that there is a "Promoted to front page" node and load it in page.tpl.php?

texts:
because front page has no arg(1) (node id)  I cannot load promoted node[s] in page.tpl.php .
all I want to do is print something in one part of front page if a specific content type node in about to load in node.tpl.php.
I search it alot but find no answer.


texts: #ajax callback not firing on Select (or other) field

texts:
I am having the exact same problem as described here: http://drupal.org/node/1335568
That is, to repost the OPs question, I have code as shown below. But when I make a change to the select box the 'change' event is not firing. as the callback is not being run.
The author of this module answered but frankly his response makes no sense to me.
His reply:

"These aren't things I should have to handle specifically. Just attach the properties directly
 to the form element (which are children of select_or_other) in a #pre_render callback.
 You might also be able to do it via #select_ajax and #other_ajax, etc... but that might
 depend on what phase of the form you are doing it."

A google search on "#select_ajax" only returns the page containing that answer! Also, his idea of a "pre_render" callback doesn't make much sense to me. Is anyone here able to untangle this? Can someone provide an example of possibly how to fix this?

if ($form['#bundle']=='field_contract_parties'){
    $form['field_select_or_other']['und']['#options'] = load_select_options();
    $ajax_array = array(
                      'callback' => 'my_callback_function',
                      'wrapper' => 'contacts-replace',
                      'event' => 'change',
                    );
    $form['field_select_or_other']['und']['#ajax'] = $ajax_array;

    $new_properties = array(
                        '#prefix' => '
',
                        '#suffix' => '
',
                    );

    $form['field_contact']['und'] = array_merge($form['field_contact']['und'],$new_properties);
}

}

function my_callback_function($form, $form_state){
    return $form['field_contact']['und'];
}
?>


texts: How would i redirect a user after registration to his subdomain site

texts:
I want to redirect a user after successful registration maindomain.com to open his site in a new tab.

His site url will look like this newuser.maindomain.com. (username.maindomain)

Any Suggestions?


texts:
I am litterally pulling my hair out and I hope that someone can help!  I'm working in Drupal 7 with Commerce Kickstart and all I want is to be able to view the flowers, grouped by their taxonomy term.

For example:
Flowers with bloom size of 5.5 inches:
flower teaser      flower teaser      flower teaser      flower teaser

Flowers with bloom size of 4 inches
flower teaser      flower teaser      flower teaser      flower teaser

etc.

Right now in the view I'm using the "grid" format grouping by the Taxonomy term name Bloom size - I have the "use rendered output to group rows" checked, but it will not group my terms and it keeps putting the same heading on down the page above each teaser.  You can see it here:  64.34.70.141/~henryl/bloom-size

I have a feeling it's something simple that I'm missing but I've spent DAYS on this one page and combing through other view examples and google searches and I can't figure it out.  Does anyone have any ideas?

Thank you!!!!!!

Candace


texts: How to increase password length while creating account on a drupal website?

texts:
I'm using Drupal 7, is there any configuration on drupal to make users choose passwords with more than 10 characters (for example) when they're creating accounts ? For now, any user can choose username, and a password can contain only one letter and it's not safe.

Thank you.


texts:
I created a set of Views based blocks which will be displayed in the Dashboard's Main Content Region.But those all of them are not for the site admins. Some of them are for other roles. So I have configured those blocks' visibility settings. Added those specific roles to the "Show block for specific roles" tab. But the problem is those are being displayed in the admin dashboard as well but with no content, actually it says "empty".

Is there any way to get rid of this?

A possible duplicate but no answers in that post as well.
Dashboard - empty blocks are shown


texts:
Very new to web development and even newer to Drupal, and I have some questions that I would really appreciate if anyone could answer!
Here's my yml file, [Site name] is actually just the name of our site:
name: '[Site name] Query'
description: '[Site name] custom queries'
package: [Site name]
core: '8.x'

Here's my .module file:
<?php

use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\query\QueryPluginBase;

function ppc_query_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
  $database = \Drupal::database();
  if ($view->id() == 'test_events') {
    $query = $database->query("SELECT node__field_date.field_date_value AS node__field_date_field_date_value,
      node_field_data.nid AS nid, DATE_FORMAT((node__field_date.field_date_value + INTERVAL -18000 SECOND), '%Y%m%d%H') AS node__field_date_field_date_value_hour
      FROM {node_field_data} node_field_data
      LEFT JOIN {node__field_date} node__field_date ON node_field_data.nid = node__field_date.entity_id AND node__field_date.deleted = '0'
      WHERE (node_field_data.status = '1') AND (node_field_data.type IN ('event')) AND (node__field_date.field_date_value >= DATE(NOW()))
      ORDER BY node__field_date_field_date_value_hour DESC, node__field_date_field_date_value ASC
      LIMIT 4 OFFSET 0
");
  }
}

I copied and pasted the query that was already being run on my view and added some changes that the views module couldn't support.
However when I run this module on my site, nothing changes. How do I get my query alter function to work?
Thank you!


texts:
I have a requirement to apply template to a specific page and not to the pages following the same url pattern.
For example I have a page with the path /asia. I also have pages with the paths /asia/india, /asia/china etc. I would like to create a template which applies only for /asia and not for other paths. I created the template file page--asia.tpl.php but it is getting applied for /asia/india and /asia/china as well. Is there a way to specifically map the template to this specific path?


texts: I have created a webform, after the submession the customer is sent the registration confirmation e-mail.  How do I include in this email a link to download a pdf ?


texts: How to programmatically import a block to existing view?

texts:
I need to programmatically import a block to existing view with its settings.

I know how to export the whole view and import it programmatically. But I don't want to export whole view and then import whole view. In my view there is 25 blocks, so it gives me 4000 lines of code to import.
I can copy export code only of my new block. But how to import only this part of code to the existing view? Is that possible? I can't find any solutions.


texts: Get all services that are tagged with a specific tag in *.services.yml

texts:
Is there an easy (supported) way to programatically get all services in Drupal 8 that are tagged with a specific tag?

For example getting all services that are tagged with "breadcrumb_builder" tag

Example for a service tag from book module:

services:
  book.breadcrumb:
    class: Drupal\book\BookBreadcrumbBuilder
    arguments: ['@entity_type.manager', '@current_user']
    tags:
      - { name: breadcrumb_builder, priority: 701 }

Now if i want to get all services from all (enabled) *.services.yml files that are tagged with "breadcrumb_builder"?

I have seen and read this: https://symfony.com/doc/3.4/service_container/tags.html

But this seems to be really hard work and I am not sure if its even possible that way without touching Drupal core.

The Reference Tagged Services method looked very promising at first, but seems not to be supported from Drupal by default.


texts: Documentation for the API exposed from Pressflow

texts:
Reading How do Pressflow Drupal sites handle user Cookies? I discovered that Pressflow 6 has a function that is not present in Drupal 6, but that is defined in Drupal 7; although, the code used by Pressflow 6 is different from the code used by the homonym function in Drupal 7.

Should developers use only the functions that are defined from the equivalent Drupal version (e.g. Drupal 6 for Pressflow 6)?


texts: How to show the following n events with respect to the current date or the past events to always ensure n elements in the view?

texts:
I have an agenda on my homepage, and I want to always ensure 5 events.

If there are 5 or more following events (including the current one), show the nearest 5 from the start date.

If there is less, show X past events in such a way that the following and the past are 5 in total.

Examples:

Today is March 12.

a) List of events (more than 5 futures):
- March 10th
- March 11th
- March 12
- March 13
- March 14
- March, 15th
- March 16
- March 17
- March 18th

Show in the view
March 12, 13, 14, 15 and 16.

b) List of events (mix, p past events, q future events):
- March 9
- March 10th
- March 11th
- March 13
- March 14
- March, 15th

Show in the view:
March 10, 11, 13, 14 and 15.

c) List of events (no future events, show recent events).
- March 1st
- March 2
- March 3rd
- March 8
- March 9
- March 10th
- March 11th

Show in the view:
March 3, 8, 9, 10 and 11.


texts: Render Profile2 field out of Profile2 page

texts:
Is it possible to render one of Profile2 fields elswhere on the page, in some node ?

I would like to present user with opportunity to edit only one field on custom link or node.

Thanks


texts: Is there an hook to react to custom entity updates?

texts:
I need to react to updates of custom entities wich are using Entity API (Redhen organization in my case).

I tried using hook_entity_update($entity, $type) but it does not seem to be fired when updating said entity.

Thank you for your time.


texts: In user permissions i let users with editor role "Access the content overview page". And this page showing them all added content. I can make a view with this user added content, but i want to achieve this with "Find content" page. How can i achieve that? I want users to show only the content they added.


texts: How to create a drag & drop sorting interface programmatically?

texts:
If you have seen the Views module, there is "sorting criteria", where we add fields and then rearrange fields to set the priority. In order to rearrange, we click on "rearrange" link and all fields get a draggable UI so that we can move it up or down to set sorting priority.

How can I do this thing exactly programmatically?


texts: How to only access a page through drupal_goto() function?

texts:
I have a form setup so that when the user enters the correct serial #, they are redirected to the download page.

I don't want the person accessing the download page directly or sharing with anyone else through the URL, as this will bypass the serial validation.

How can this be done in Drupal?


texts: Views field view: contextual filter send value only one time

texts:
I have view which is displaying only 2 nodes.
I add views field view to another view which is display all nodes which are from another content type but with the same date as his parent node. I filter it by contextual filter and everything is working but I have a problem with second parent node. It is display fine but it looks like that it is passing contextual filter from the first parent and to parent 2 view is displaying child from parent 1. Where is the problem? Is it passing contextual filter only one time and after that is it using only this contextual filter?
for 1 parent I am passing contextual filter [%field_date] with value 2012-10-13 and it showing me all nodes with this date.. it is good. But for second parent I need value 2012-10-14 and it looks like it is still 2012-10-13 from first passing of contextual filter.

now I have this result

parent 1
    - child 1 of parent 1
    - child 2 of parent 1
    - child 3 of parent 1 ....
parent 2
    - child 1 of parent 1
    - child 2 of parent 1
    - child 3 of parent 1 ....

but I need something like this:

parent 1
    - child 1 of parent 1
    - child 2 of parent 1
    - child 3 of parent 1 ....
parent 2
    - child 1 of parent 2
    - child 2 of parent 2
    - child 3 of parent 2 ....

Thanks a lot for all your replies :)

updated

after hours of testing I thing that there is a problem with passing date from parent field date. When I get it as contextual filter into child view with [!field_date] and after that I use it in header of view with %1 it is blank. I need to use it with !1 paramater and ther it look good. But in contextual filters of child view I cant spcify in which format I want to use parameter. I think there is a problem with sending paramater from parent to child view, but I cant find it.


texts: How to use preprocess field to style radio buttons

texts:
Trying to set up a preprocess_field.I have list field by radio buttons and I want to override the output like this:

         <button type="button" data-toggle="tooltip" class="btn btn-success" title="" data-original-title="The event has been confirmed and will proceed at the specified date and time.">
         &nbsp;&nbsp;Confirmed event</button>


texts:
Here is the form:

function payment_form($form, &$form_state) {
  $form['#tree'] = TRUE;

  // since credit card is also an option, the gift card section is contained in this div.
  $form['payment']['giftcard'] = array(
    '#type' => 'container',
  );

  // there are additional fields above here, but trimmed them out since they are not relevant to the issue.
  $form['payment']['giftcard']['giftcards'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array('giftcards'),
    ),
    '#prefix' => '
',
    '#suffix' => '
',
  );

  // initialize the gift card field counter
  if (!isset($form_state['gift_cards'])) {
    $form_state['gift_cards'] = 1;
  }
  // build the fields
  for ($i = 0; $i < $form_state['gift_cards']; $i++) {
    $form['payment']['giftcard']['giftcards']['gift_card_number'][$i] = array(
      '#type' => 'textfield',
      '#title' => t('Gift Card Number'),
      '#title_display' => 'invisible',
    );
  }
  // validate the current gift card and add another field.
  $form['payment']['giftcard']['giftcards']['validate'] = array(
    '#type' => 'submit',
    '#value' => t('Validate'),
    '#ajax' => array(
      'callback' => 'validate_giftcard_add_field',
      'wrapper' => 'giftcards-wrapper',
      'method' => 'replace',
    ),
  );

Here is the callback function for the AJAX call. There is no validation currently, just trying to get it to add another field. If I add print statements in this function they are being output in a javascript alert, so this function is being called. However it is not returning any new fields.

function validate_giftcard_add_field($form, $form_state) {
  $form_state['gift_cards']++;

  return $form['payment']['giftcard']['giftcards'];
}

What is the right way to add new fields via ajax?

Additionally, all instances of  '#required' => TRUE, have been removed during my testing. I have not done anything with the validate or submit callbacks either.


texts:
Some users (not admins) on our system are not having their password reset links sent by _user_mail_notify('password_reset', $account, $langcode) work properly. A suspicion is that their e-mail clients are not parsing the entire link as one URL.

In /admin/config/people/accounts, I'm trying to use [user:one-time-login-url] as a href attribute, like click.

Using default PHP mailer, this doesn't really change anything, it just makes the link show up as click [1] and spits out the URL text at the bottom of the email.

I've had swiftmailer installed for a while, and I use it specifically for some module emails that require attachments. However I avoid using HTML emails as the HTML never parses properly no matter what settings I use. For example, the <a href=... code above comes out as &lt;a href=&quot;https://... when the e-mail is sent, even if I set Swiftmailer to use HTML and uncheck "Respect provided e-mail format."

Is there a way to accomplish what I'm trying to fix?


texts: Multiple choices select with data module created view

texts:
on my website I have a custom table, and I used the data module to create a view that uses the entries in that table.
I have created an exposed filter for one of the columns. Since I needed a select form and only search box was available, I used this code:

function mymodule_form_views_exposed_form_alter(&$form, $form_state) {

$form['myfield']['#type'] = 'select';
$form['myfield']['#multiple'] = true;
$form['myfield']['#default_value'] = array("" => "All");
$form['myfield']['#options'] = $values;
$form['myfield']['#attributes'] = array('size' => 10);

}

The problem is that when I select multiple values, it performs an "AND", but I need an "OR".
How can I procede?
Thanks!


texts: How to get current language in html.html.twig of theme

texts:
I need to get the current language in the html.html.twig file of my theme. In my page.html.twig I can use:

{% if (language.getId() == 'nl') %}

This does not work in my html.html.twig. Any ideas?


texts: Change region/block content based on current node

texts:
I am trying to figure out how to change the content of a region/block depending on the node being viewed.

Lets say I was creating a website for a grocery store. The home page will have several links for the various departments ... Meat, Seafood, Dairy, etc. When the user clicks on one of these departments they will go to a node where there is a menu that lists all the items in that department ...

Meat => Steak, Hamburger, etc.
Dairy => Milk, Eggs, Cheese, etc.
Seafood => Shrimp, Tuna, Salmon, etc.

What I am trying to figure out is how to display the correct item menu for the selected department. How to I display the menu of all the dairy products when the user selected the "Dairy" node?

Ideally I would like to accomplish this without hard coding changes into the template as I would like the site owner to be able change things themselves.

Thanks for any suggestions!


texts: How to test a custom filter on existing view?

texts:
I programmatically created a new (custom) filter for the user's view (admin/people).

Code for the filter:

hook_field_views_data_alter()
Plugin > views > filter class

The filter works perfectly, but when I execute BrowserTests, the filter is not available in the view.
Probably because the user module installs the view and does not contain my custom filter.

Is there any way to make this filter available in my testing suite?

update

Tried both solutions in @4k4's comment. Both give me schema validation errors.

Solution 1 (adding the filter in code):

"Schema errors for views.view.user_admin_people with the following errors: views.view.user_admin_people:display.default.display_options.filters.field_ mymodule_target_id.type missing schema"

Solution 2 (adding the view in yml in my config/optional folder):

1) Drupal\Tests\mymodule\Browser\MyModuleViewBrowserTest::testFilterQuery
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for views.view.user_admin_people with the following errors: views.view.user_admin_people:display.default.display_options.filters.field_ mymodule_target_id.value non-scalar value but not defined as an array (such as mapping or sequence), views.view.user_admin_people:display.default.display_options.filters.field_ mymodule_target_id.expose.reduce missing schema, views.view.user_admin_people:display.default.display_options.filters.field_ mymodule_target_id.reduce_duplicates missing schema, views.view.user_admin_people:display.default.display_options.filters.field_ mymodule_target_id.type missing schema, views.view.user_admin_people:display.default.display_options.filters.field_vrt_channel_target_id.error_message missing schema


texts:
I'm using drupal 7 and i made a view that has a pager.
Is there any way to put the pager-item (pagers number) inside any html tag?

// new html tag

1

2

3

4

......


texts: How to call a javascript function in a node template?

texts:
I am having a bit of trouble figuring out how to call a javascript function I have in a node template.

The flow I am trying to achieve is a user clicks a link (its a link which activates the colorbox module).  This then loads a node template with a video and my custom javascript function I want to call.  Then when the user closes the colorbox a callback is made which should then call my custom function.

I have a general javascript file loaded into my omega theme which listens for the colorbox link and on the close callback I want it to call the function defined in the called node.

The javascript in my functions file is:

(function ($) {
Drupal.behaviors.l_d_links =
{
    attach: function (context, settings)
    {
        $('.colorbox-load').colorbox({
            onCleanup:function(){ dbUpdate(); }
        });
    }
}
})(jQuery);

And javascript code in my node is:

function dbUpdate() { console.log("start $.post"); }

Just to add the reasoning behind putting the function in the node template is because I need access to some php variables on node load.
Is something like this possible?


texts: Drupal 8 config yml differences due to ordering/positioning of elements

texts:
Got a really annoying thing related to config-import/export, due to the positioning of elements in the yml file the config never syncs between production server and development server.

For example:

diff --git a/config_webform/webform.webform.acceptance_criteria.yml b/config_webform/webform.webform.acceptance_criteria.yml
index d4d54d3..5c4a504 100644
--- a/config_webform/webform.webform.acceptance_criteria.yml
+++ b/config_webform/webform.webform.acceptance_criteria.yml
@@ -1,3 +1,4 @@
+uuid: 756ff0d5-8986-4d50-9097-80da19affd53
 langcode: en
 status: open
 dependencies: {  }
@@ -140,4 +141,3 @@ access:
     users: {  }
     permissions: {  }
 handlers: {  }
-uuid: 756ff0d5-8986-4d50-9097-80da19affd53

On the above example git diff, you can see the uuid element was removed from the bottom and added to the top. That's the only change. This was exported from local development server and if I try to import this to production server it never imports (keeps saying there's a config update after running drush config-import). So if I export the config from live, the uuid element is removed from the top and added back to the bottom.

Does anyone know if:

this is a bug with a specific module and the way it exports the config? (Webform in this example)
or a bug with core
or this is related to the different versions of server software (Either or all of: nginx/php/operating system/mysql)
or something I haven't mentioned above as one of the causes

I just wanted to know where to dig before digging in too deep in the wrong area.


texts:
I configured the site aliases for the development, and staging sites. I have the <DRUPAL_HOME>/sites/default/aliases.drushrc.php aliases file with this content:

$aliases['dev'] = array(
  'root' => '/home/drupaltest',
  'uri' => 'localhost',
  'path-aliases' => array('%dump' => '/home/drupaltest/dump.sql')
);

$aliases['stage'] = array(
  'root' => '/home/drupaltest',
  'uri' => 'naftalin',
);

$aliases['all-scratch'] = array(
  'site-list' => array('@dev', '@stage'),
);

drush @dev status outputs:

  hubidubi@couscous:/home/drupaltest$ drush @dev status
       Drupal version         :  6.25
       Site URI               :  localhost
       Database driver        :  mysqli
       Database hostname      :  localhost
       Database username      :  root
       Database name          :  drupaltest
       Database               :  Connected
       Drupal bootstrap       :  Successful
       Drupal user            :  Anonymous
       Default theme          :  garland
       Administration theme   :  garland
       PHP configuration      :  /etc/php5/cli/php.ini
       Drush version          :  4.4
       Drush configuration    :
       Drush alias files      :  /home/drupaltest/sites/default/aliases.drushrc.php
       Drupal root            :  /home/drupaltest
       Site path              :  sites/default
       File directory path    :  sites/default/files

Then I tried to run drush rsync @dev @stage command to sync dev site to stage and I get:

  Could not evaluate source path @dev.

I can't figure out the problem; I think the alias file is correct.

Do you have any idea?


texts:
I have created two Views, I then placed the second view on the footer of the first view. Main view has date, an image, attachment and size of the attachment, the second one has an images that are linked to a files.
Output, latest one should always display on the top with an image, attachment and size of the attachment which I got it right when I click on the image from the footer I want an image to display above with the attached file and the size. May anyone help on how I can do the switching part in. See an the attached, am using Drupal 7


texts: Video Transcoding and ffmpeg converter is not working : PHPVideoToolkit error

texts:
I am trying to play *.flv using Video Module and FFMPEG Converter.
Whenever I upload any flv video I get the following message:

  PHPVideoToolkit error: Execute error. It was not possible to encode
  "C:\xampp\htdocs\Resonance\sites\default\files\videos\original\barsandtone_3.flv"
  as FFmpeg returned an error. The error is with the video codec of the
  input file. FFmpeg reports the error to be "Error while opening
  encoder for output stream #0:0 - maybe incorrect parameters such as
  bit_rate, rate, width or height".

Installed Modules are:

Video - 7.x-2.9
Video.js - 7.x-2.3 - Version: 4.0.3
Video transcoder: FFmpeg / avconv : git: c2dd5a1
JW Player

All are installed correctly.

Configuration of Video Module:

Inside Player Tab of Video(admin/config/media/video/players), following has been configured:

A New FLV Preset has been created and added under Preset Tab of Video(admin/config/media/video/presets). Details are as follows:

Preset name: FLV Preset

Video output extension: FLV Flash Video

Video codec: H 263/H263-1996,H263+/H263-1998/H263 Version 2 (Not sure about Video Codec)

FFmpeg video preset: None

Video quality: None

Video speed: None

Dimensions: 640 x 360

Aspect mode: Preserve Aspect Ratio

When I am uploading the video from content type then it extract the thumbnail as follows:

After saving the video it shows the following message:

My gut feeling is that I am setting up wrong preset but I am not able to solve this problem.


texts:
so, I really got stuck. I did a lot of discussion in the IRC and reading but I just fail at it. It should be very easy since it's very simple.

I have a content-type "foo" and I use a view (as a block) to query them from the DB. Now, I'd like to create HTML in one big template. Currently, I created a node template for that content-type and a view template but this doesn't allow to build proper html, instead it forces me to use rather ugly html since it just passes the html created in the node template to my view template.

What I need is to mix the HTML. E.g. if my content-type has the fields "field1, field2, field3" and 3 items, then I'd like to create a html like this:

   item1-field1
   item2-field1
   item3-field1

   item1-field2
   item2-field2
   item3-field2

   item1-field3
   item2-field3
   item3-field3

so how can I do that? How can I access all items and their fields within a view template? I'd like to have full control over the rendered html of the block. I'm on D7.


texts:
I have a query concerning the core Testing module and the SimpleTest module.

When I install a new site, the Testing module is available but disabled. When enabled, a list of tests are available for a whole range of resources such as nodes, users etc.

When I install SimpleTest these tests disappear along with the core Testing module. They are replaced by five example SimpleTests.

Could someone explain the differences between these two modules?

Also, is it possible to use these initial tests within SimpleTest?


texts:
I am using a javascript datepicker to allow users to select a date (which I have functioning in my form). What I don't know how to do is limit the dates that can be selected. Is there a way to do this using the datepicker instead of validating the form on submission?

Here is the code I am using to create the date selector:

drupal_add_library('system', 'ui.datepicker');
drupal_add_js($path . '/providers/support/js/datepicker.js');
drupal_add_js(array('dateselector' => array('date_format' => $date_picker_format)), 'setting');
return array(
  '#type' => 'textfield',
  '#default_value' => $current_value,
  '#attributes' => array('class' => array('datefield')),
);

Am I missing an option somewhere?


texts: node not listed under create content for panel page

texts:
I'm following this book called drupal 6 panels cookbook. With panels installed, the example in the book says to go to the Panel UI of the new panel, click on the content tab> click gear icon > click add content

Then, a windows pops up and it has a couple of links on the left side that you can click. Listitems are Activity, cTools examples, menus...

What is supposed to be listed also is 'form' and 'node' but they're missing. At first I thought it was because maybe CCK wasn't enabled but everything that has to do with the CCK module is enabled.

Honestly don't know where to look.


texts:
In Drupal 7
I want to make a view of

/------------------------
--------- Header --------
List of links to nodes

/-------------
Node content

When the links of nodes in Header clicked, the node content should be loaded by ajax.
Is there anyway to do this by Views? or do I need some custom PHP?


texts: How do I show only the latest post from each user in a view?

texts:
I'm trying to show a list of only the most recently published post by every user (not including the logged in user) in a view. What should my Views filters look like in order to accomplish this? I'm completely stuck!

At the moment, my view shows all posts from all other users. I now need to filter it down once more so that it ONLY shows the most recent post by all of these users.

Reference (issue):


texts: How to make the title field of a node/add form hidden or locked

texts: I'm prepopulating the title of the node/add/content_type using the URL. I would like this form to be hidden or locked so that the user can't accidentally edit it. I've been looking though the Drupal documentation and haven't found a way to hide fields at all. Any help would be appreciated.


texts: Customize Flag Ajax Message on Rules Trigger

texts:
Greetings fellow Drupalers,

We're using Rules to listen for a flag trigger. And we wanted to present a custom mesage set in rules to the user after he triggered this as well. Since we're using the AJAX toggle, no message would be presented, however since there's no page load.

What's the best course of action for the desired funcionality? Or even which direction would you follow?

Best regards.


texts: URL Link to Calendar Month view from Existing View

texts:
I have a page with some global header text. The page lists some events in a tabular format. I'd like to add a link (url) to my calendar within the text. I've tried to code a "<a href>" tag with what I thought was an appropriate url, but, I get the following:

  Warning: Creating default object from empty value in
  calendar_plugin_row->pre_render() (line 312 of
  /home3/hartfos4/public_html/mysitename/sites/all/modules/calendar/includes/calendar_plugin_row.inc).

followed by:

  'calendar_plugin_style: A date argument is required when using the
  calendar style, but it is missing or is not using the default date.'
  in calendar_plugin_style->render() (line 238 of
  /home3/hartfos4/public_html/mysitename/sites/all/modules/calendar/includes/calendar_plugin_style.inc).

Is there any way to compose a url to link to the calendar month?


texts: Node's teaser view mode has extra "panels-default" markup/wrapper/classes

texts:
I'm using bootstrap 3 as basetheme and Physics as main.
On content types view mode (teaser) I've created a Horizontal tabs group and added 3 Horizontal tab containers under it.

The problem is that content inside Horizontal tab is wrapped with Bootstrap panel markup which creates unnecessary borders and shadows. I can't find that where this is defined.

And since Horizontal tabs and Horizontal tab aren't part of either themes or supporting modules it seems weird that content is wrapped in any bootstrap markup.

Result

View mode/containers setup

UPDATE

The question is that why are these fields wrapped with a bootstrap panel markup?


texts: Creating the custom url aliases for nodes?

texts:
I had a problem with making custom url aliases for drupal node pages.Basically my website have two articles types parent articles and child articles. Each parent article contains many child articles. So the each parent articles shows all  it's child articles in pagination.
current format
parent article : http://example.com/parent-title
child  article : http://example.com/parent-title?page=1, http://example.com/parent-title?page=2 go to each child artilces of parent article.

however I want to insert title of the child article as url alias so expected format is
http://example.com/parent-title/child-title?page=1

How can i insert that child article title as url alias? I need this because this is very good for SEO purposes.


texts: Weird error using encrypt module with migrate and migrate_d2d modules

texts:
I'm having a weird message pop up when I go to the migrate group I'm trying to port content over from.

The message I get is :

  Failed to decrypt argument source_database

I have no idea what source_database is and what argument it's trying to decrypt.

Any information on this would be greatly appreciated.

Thanks in advance.


texts: How use bulk action (VBO) with table pagination?

texts: I have a table result with n pages. I would like to be able to select checkboxes from several different pages of results and then execute a bulk operation. However, when I have selected a checkbox and go to the next page my previous choices are lost. How can I keep my choices saved across page loads?


texts: Add user picture to profile 2/any entity for that matter...

texts: I've disable user pictures in User account and want it displayed in Profile2.  I can add a field for Image.  But, it's not recognized as the official user picture; so it can be used in comments, node views, etc.  How can I do that?


texts: How to display the 4th level of a menu using the Menu Block module?

texts:
I use the Menu block module for a menu block that should display the 3rd and 4th levels of my main menu. It works great for the 3rd level of my menu, but for some reason I can't get it to display the 4th level of my menu as well. Does anyone know why that might be or how to fix that?

I have gone through most of the code in the menu block module, and everything I have found says that the 4th level is being rendered correctly, but it doesn't exist in the output code for some reason.


texts:
I have two content types.
1. Referrals: Name, other info type fields
2. Referral semesters: start date, end date

I want to list all referral semesters out while counting the number of referrals there were in between the referral semesters start and end time. Looking at the referral creation date.

I've started a view of semesters but see no where I can relate it to referrals in the relationship area.

example:
Spring 2016: 17
Summer 2016 : 22


texts: How to change URLs of Mini-Calendar Block View?

texts:
I'm using the calendar module in drupal 7. I put the block-view mini-calendar but I want to make a change to the URL of each day's link of the month that showing me.

By default, the URL sent me to the full schedule of activities in that month (use event_calendar content type). However, I want to change that view and I just want to make a simple listing of activities for the month.

How I can change the URL to do access the new view I want to create?

Sorry for my english. Thanks in advance.


texts: Workbench Moderation - Issues with New Drafts of Published Nodes

texts:
I'm using Workbench for workflow, along with Workbench Access, Workbench Moderation and Workbench Moderation Notes on a new Drupal 7 site.

I have set up rules for emailing approvers/editors on certain moderation state changes which work for the most part.

However, when I create a new draft of a published node, the Draft to Needs Review emails are not triggered unless I explicitly save the node first. This will be quite a common occurrence when the site goes live and I would much prefer the users not having to save the node before changing the status.

Does anyone know why this is happening or any workaround (e.g. use node_save() somewhere to save in the background)?


texts: How do I automatically assign a node to a term?

texts:
When an user role changes and becomes "writer", there is a rule that creates a new entity type "taxonomy term" name "user name" and assign it to vocabulary "writers". This works.

Now, the user can create stories. When this user creates stories, this content type should be assigned to term "author name" to vocabulary writers.

It is possible without using PHP, simply adding some actions?


texts: Show last node of every term in one Views

texts:
How to show the last node of every term using only one View? That's what I want to get:

news/football - last node of the football term

news/boxing - last node of boxing term.

How can I do it?


texts: How do I configure the "input format" for the File Tree module?

texts:
My question is in the input format step.  How do I "add File Tree to your input format?"

Here are the instructions from the File Tree module:
"Enable the module, and add File Tree to your input format. Then, enter [filetree dir="some-directory"] into the body field of a node, and it will render a list of all the files in that folder. (Note, the folder must reside in your site's "files" folder.)"

When I go to configure the module, I'm taken to
Home » Administration » Configuration » Content authoring » Text Formats

Filtered HTML - anonymous user, authenticated user, administrator
Full HTML - administrator
Plain text - All roles may use this format.

It says "Improper text format configuration is a security risk," so I want to make sure I have this right.  What is it that I need to add where to make File Tree work, safely and securely?

I found how to set the input format to use the input filter implemented by the File Tree module:

Go to text format configuration, accessible again by Home » Administration » Configuration » Content authoring » Text Formats (or by clicking on "Configure" for the File Tree module)
Click on Full HTML.
Halfway down, there should be several check boxes, among them one for "File Tree."  Just check that box and you're set.

Now, from here, I still haven't been able to get the module to run. Despite this change, I still see [filetree dir="dirname"] printed plainly where I try to insert a file tree.

(This video helped me: http://www.youtube.com/watch?v=ASKqit7kDak.)


texts: How can i increase the size of color box pop up window in drupal 7. .?

texts:
I have implemented Colorbox module and configured it for my image gallery. But the issue is when I load the colorbox pop up window it seems to be very small in size. Even I tried using CSS setting height and width as 100%, but it's not making any difference.

Can anyone tell me as how to adjust the height / width of colorbox pop up model window?


texts:
I have been getting the following notice from Google's IP address:

  Unable to generate the derived image located at public://styles/large/public/field/image/imagefield_b9xgKB.jpg

Why does it happens? It started a week ago, and now it happens few times in a day. Sometimes the filename varies.


texts: Let's Make A Module that Generates a Block that uses a Template in D6

texts:
A Module (sites/all/modules/custom/reminders/reminders.module)

<?php
// $Id$

function reminders_block($op='list', $delta=0, $edit=array()) {
    switch ($op) {
        case 'list':
            $blocks[0]['info'] = t('Reminders Block');
            $blocks[0]['cache'] = BLOCK_NO_CACHE;
            return $blocks;
        case 'view':
            $block['content'] = 'dummy text that is replaced by block-moduleName.tpl.php';
            return $block;
    }
}

A Template (sites/all/modules/custom/reminders/block-reminders.tpl.php)

<?php
    drupal_add_css(drupal_get_path('module','reminders') . '/reminders.css');
?>

Hey! Don't forget!!

A Mystery

This has fluctuated between working and not working. I see lots of modules using this tidy file structure where the .module and .tpl.php can live together. That's what I'm hoping for. Devel's Theme Developer module told me to use block-reminders.tpl.php and from what I've read it's okay to put the template file next to the module instead of all the way in the theme somewhere.

A Few More Things

I cleared the theme registry

The Question

What's missing so that I can use this more elegant method of developing modules? I wanted to let drupal cascade with as many defaults as possible so there's not as much code.


texts:
Is it possible to translate this type of view field, Or use t() in this field for single words?
I'm using the Internationalization and the Internationalization Views modules, but I can't translate these fields.


texts: Where is comment admistration template located?

texts: I have a Drupal 7 sub-theme based on Bootstrap 3 theme, the comment admin page (http://www.example.com/comment/46849/edit?destination=admin/content/comment/approval) looks as shown below. It is however missing the ability to edit Author and Url fields. I would like to know which template file I need to edit to get this functionality.


texts:
I am using drupal 7 with ubercart.  Since I do not currently have a method to accept credit cards, I am using paypal express.  The issue I am finding is that still in the cart view there is a checkout button and a paypal button.  If the user clicks the CHECKOUT button they are taken to the next page but can go no further since there are no Credit Card options currently enabled.

Is there a way to only show the PAYPAL button in the cart? If so where?  I am not sure which file I should be looking in for the cart form.


texts: Drupal rendered page for directory root, followed by static pages?

texts:
I have a directory that I want to load through the Drupal system, which of course is fine with clean URLS:

  /my-dynamic-page/

However at this directory I then want to serve static pages

  /my-dynamic-page/static1

When I add a folder for /my-dynamic-page/ to the server, this now bypasses the Drupal system. While the static pages now work, when you try and load /my-dynamic-page you get a Forbidden error. This is because the Drupal system has been bypassed (there is a physical folder now) so the system looks for an index file.

How do I overcome this?


texts: flexslider keeps crashing when i try to change settings

texts:
I have used all the latest Flex Slider modules and library, I have created a View, with format of slideshow, the Slideshow Type is defaulting to Flexslider, and I'm using the default Optionset.

I have the title of the slide and the image being displayed. everything works as expected in terms of it being responsive, however, if I edit the View, then click Settings under Format, and then either click Save or Cancel, I get a few pages of rubbish displayed (see below) can anyone help?

  [{"command":"settings","settings":{"basePath":"/rltc/","pathPrefix":"","ajaxPageState":{"theme":"seven","theme_token":"l_FB7jWDCmNamBi4J7kqnOrggLfAI3b3oWvjYgjabko"},"states":{"#edit-style-options-flexslider-views-slideshow":{"visible":{":input[name=\u0022style_options[slideshow_type]\u0022]":{"value":"flexslider_views_slideshow"}}},"#edit-style-options-views-slideshow-cycle-timeout":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][transition_advanced]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-speed":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][transition_advanced]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-delay":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][transition_advanced]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-sync":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][transition_advanced]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-random":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][transition_advanced]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-start-paused":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][action_advanced]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-remember-slide":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][action_advanced]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-remember-slide-days":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][action_advanced]\u0022]":{"checked":true},":input[name=\u0022style_options[views_slideshow_cycle][remember_slide]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-pause-in-middle":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][transition_advanced]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-pause-when-hidden":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][action_advanced]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-pause-when-hidden-type":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][action_advanced]\u0022]":{"checked":true},":input[name=\u0022style_options[views_slideshow_cycle][pause_when_hidden]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-nowrap":{"visible":{":input[name=\u0022style_options[views_slideshow_cycle][action_advanced]\u0022]":{"checked":true}}},"#edit-style-options-views-slideshow-cycle-fixed-height":{"vis


texts: Is there a way to add a button to my form that does not submit the form but performs a mini validation and adds more inputs to the form

texts: In my module's admin configuration page, I have a simple textfield that needs to be filled out before any other input of the form even appears. I thought that this could be done by adding a small button next to the textfield that, when pressed, will perform all the validation that I need (I have already created the functions that will be used) and then additional "select" form elements will be generated. Anyone knows how I can do this?


texts: Contextual filter in path for block view display, alongside pathauto aliases in Drupal 8

texts:
On our Drupal 8 site, we are using the article content type for press releases. We have the pathauto module generating automatic aliases for these nodes, so the article node entitled "Cool Things are Happening" would get the url /press-releases/cool-things-are-happening.

Additionally, we have a view of press releases, at /press-releases. This is provided by a view of articles that has a page display.

Our marketing department wants some changes implemented to the page delivered from /press-releases. Since we have the paragraphs module installed on our side, I decided the best way to future-proof the page would be to disable the press releases page display, create a block display of that view, and add a basic page with the press releases block display in a paragraph, and set the alias of that node to /press-releases.

However, one of the requested changes is a year filter feature on the press releases page, so that the results of the view can be filtered by year.

I have that filter working on the view, as I've confirmed in the block display preview. I've added a custom block to the new /press-releases page that has links to /press-releases/2019, press-releases/2018, etc. The idea, obviously, is that the second part of the path would be the value for the contextual filter on the block display of the view.

However, I'm not sure if it's possible, and if it is, then how to specify a wildcard route in Drupal 8 that passes the second url parameter to the contextual filter. Currently, when I navigate to /press-releases/2018, I get a 404, which is not unexpected.

Since the view display is not a page, but a block, I don't see where I can indicate a path with a wildcard value, like /press-releases/%. (It's been a while since I've developed for Drupal 7, but I seem to recall that's how values were grabbed from paths.)

Editing the Contextual Filter on the block display of the view, I tried adding "Raw value from URL". I set the settings

When the filter value is NOT available
 - Provide default value
    - Type: Raw value from URL
    - Path component: 2
    - Exception value: all

However, with these settings, /press-releases and /press-releases/all show the page with an empty view block display, and also paths with the year value (like /press-releases/2018) are also empty. However, node paths still work. I'm not sure if I'm using the wrong settings, or if this way is not going to work regardless.

This answer shows how to get a value from the URL using the InboundPathProcessorInterface in a custom module, but I'm not sure how to then pass that value to the view's block display in the paragraph. Also, if I'm using /press-releases/% as my pattern to match, I don't want to interfere and break existing node paths at e.g. /press-releases/cool-things-are-happening. I only want to match YYYY, where Y is a number. (I could do more advanced validation for the year, but I can pretty much guarantee we are never going to have just a year by itself as the actual title of a press release node.)

How can I pass the year value to the contextual filter? Have I gone down the wrong path for developing this feature?

We are on Drupal 8.7.3.


texts: I want to merge 2 forms together (user register form and node registration form). Should I use multiform module to achieve this or create new form using form API?


texts: What is the proper way to set up an AWS Auto-Scale group?

texts:
What is the proper way to setup an EC2 Web Server with the aim of serving a site which experiences high demand once a month via 1 small EC2 for 90% of the time and then enter a load balanced group for the other 10%.  I understand the AWS mechanics, AMI, auto scaling, metrics, and load balancer, but I don't know the best practices of setting up a CENTOS server to serve multiple servers.

I was thinking http://tecadmin.net/mount-s3-bucket-centosrhel-ubuntu-using-s3fs/# with S3 buckets (I ran into a few problems), but would a simple mounted volume be better?

I would really appreciate advice from anyone who has used AWS in this way with Drupal.  Another article I read is Using a load balancer or reverse proxy.

Obviously, performance is a big consideration. I know S3 is fast, but I imagine it's slower than using a mounted volume.


texts: Error "The value you selected is not a valid choice." in drop down list

texts:
I want to list node titles in drop-down list programmatically.
I have done below code in form_alter hook.

function product_custom_form_alter(&$form, FormStateInterface $form_state, $form_id) {
 if($form_id == 'node_inventory_form') {
  $nids = \Drupal::entityQuery('node')->condition('type','product')->execute();
  $nodes =  \Drupal\node\Entity\Node::loadMultiple($nids);
  $product_title = array();
  $product_title['_none'] = " - None -";
  foreach ($nodes as $node_content) {
     $title = $node_content->getTitle();
     $product_title[$title] = $title;
  }
  $form['product_name']['widget']['#options'] = $product_title;
 }
}

It showing the title list proper but i'm getting this error "Error message The value you selected is not a valid choice." while saving the node.


texts: How do I create a nested tree with terms & nodes with Views 3?

texts:
I need to create something similar like this:

Colors (Vocabulary)

Red (term)

Dark (term)

Node 1
Node 2

Light (term)

Node 3
Node 4

Blue (term)

Node 5
Node 6

Green (term)

Node 7
Node 8

(Bullet points are indents.)
Is there a way to do this with Drupal 7 and views 3? If not, is there another way to do this?


texts:
I'm creating a site which has products, brands and affiliates. Products and brands are in the same taxonomy while affiliates are separate.

Products are terms that are children to brands. Affiliates are referenced in the brand term. I have the basic structure below for reference.

I'm trying to create a view that shows a users 10 favorite products along with the brand and url's for affiliates that carry the product. I've made my relationships in the view, but instead of displaying each brand with a link to the affiliates it duplicates the brand once per affiliate. In other words, if the brand has 3 affiliates it would show the brand 3 times with a single affiliate link under each.

How can I make my view combine the affiliates into a single result?

Product/brand taxonomy
-name
-affiliate(term reference to affiliates)

Affiliates taxonomy
-name
-logo
-url


texts: I want to display one content type inside of another

texts: I have a page called "Our Team" that will display all the members of our team. I have a content type called "Team Member" and have created many team members under this content type. How can I list all "Team Members" on one page?


texts: migration using csv and yml for multivalued image field

texts:
some problem with sub-process plugin. Here are my yml and csv files.
uuid: c0948690-b539-421e-b306-6a49d14afd64
langcode: en
status: true
dependencies: {  }
id: migration_multivalues
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: null
migration_group: default
label: migration_two_files
source:
  plugin: csv
  path: 'C:/xampp/htdocs/drupal/sites/default/files/tasktwo.csv'
  header_row_count: 1
  ids:
    - id
  constants:
    file_source: 'filesandimages/'
    file_destination: 'importedfilesandimages/'
process:
  title: title
  body: body
  field_multivalue_image:
    -
      plugin: explode
      delimiter: ','
      source: image
    -
      plugin: single_value
      handle_multiples: TRUE
    -
      plugin: sub_process
      key: '@fids'
      process:
        fids:
          plugin: concat
          source:
            - constants/file_source
destination:
  plugin: 'entity:node'
  default_bundle: article
migration_dependencies:
  required: {  }
  optional: {  }

csv file
id,title,body,image
1,"Faculty one","One","dolon.jpg,intern5.png"
2,"Faculy two","Two","intern5.png"
3,"Faculty three","Three","dolon.jpg"
4,"Faculty four","Four","intern5.png,intern6.png"
5,"Faculty five","Five","dolon.jpg,intern5.png"

Warning: A non-numeric value encountered in Drupal\migrate\Plugin\migrate\process\SubProcess->transform() (line 204 of C:\xampp\htdocs\drupal\core\modules\migrate\src\Plugin\migrate\process\SubProcess.php)
Error: Unsupported operand types in Drupal\migrate\Plugin\migrate\process\SubProcess->transform() (line 204 of C:\xampp\htdocs\drupal\core\modules\migrate\src\Plugin\migrate\process\SubProcess.php)


texts: How to show popup for save or view the file?

texts:
I am displaying file names as links on the page, when I click on particular link, it should ask the user that, save file or view file something like below image.

In my case this popup is not coming, directly the file content is displaying on browser. So how can I achieve this. Thanks for your any suggestions.

My code to display dynamic links as follow:

$uri = 'public://';
  $path= file_create_url($uri);

$data .= '
' ."--". $filenames .'

';


texts: How to configure role to edit only specific nodes by field?

texts:
I have a content type named "Event". I created a field named "Type" so I may create different kinds of Events (eg. Courses, Lectures, Conferences).
The problem is that each type of Event is administered by different people. And one is not allowed to edit other's content.
How is the best way to do this?
Or is it better to create a content type for each type of event?


texts: Services Module - Access Denied for User Admin

texts:
I'm trying to get a REST server going with Services, testing locally. It seems like things are running, but I'm denied from using any of the resources, even as an admin!

I'm trying to follow the simple directions here. My endpoint is 'test', I've enabled the node resource and session authentication. When I visit something like localhost/test/node or localhost/test/node/1, I get back an xml snippet:

<result>Access denied for user admin</result>

Clearly I'm hitting the service. I'm able to view the node the normal way (visiting localhost/node/1).

I'm quite confused, and have a hell of a time searching for answers. There are lots of people with issues authenticating using services, but none like this. Any idea where I'm going wrong?

It works on my site. Still no joy on localhost. It may be due to document root - see the post by yuchuan1 on February 5, 2013 at 6:44am here.


texts:
I have a content type with a file field. In a view I am trying to make the title link to the document. So that when someone clicks the title it downloads the file.

In Views for the title field I selected 'output this field as a link' and in 'link-path' I entered [field_file] which is valid.

When I click the title I get a page not found error.
The requested page "/%20the%20file%20name.xlsx" could not be found.

So it seems it is treating the link as a url link. How can I change this so that it downloads the file?


texts: link field template syntax / display link field as an image / devel dpm (D7)

texts:
My link field is currently displaying as a URL as you can see here (yellow border). I have added dpm($items) to my link field template file. How do I read the dpm output or more specifically how do I edit my template file to say "display this field as the specified image"?

The following example works in a different situation where the field is an uploaded file but in this case the field is a link.

<?php $path = $items[0]['#file']->uri; ?>
<a href="<?php print file_create_url($path); ?>">


texts: Creating menus links for displaying articles with specific tags

texts:
How would you go about creating a categorization system which categorizes after tags and then displays a link to the page with only the specific tags linked/posted?

Aka 1 page per category. On each page there is series of blog-posts/content which has the same tag (I believe this is called the taxonomy term?)

and then of course add the links to the pages to the menu (got this one as long as there is an URL)

Thanks!


texts: Displaying Content Flagged by User Name with Flag Module

texts:
I'm using Drupal 7.38 with the Flag (v7.x-3.6) module, along with Views. I'm setting up a flag for content.

My goal is to display a list of users whom are flagging content (along with aggregated count of number of items flagged). With the desired ULTIMATE goal of being able to click on the user's NAME (not UID!) and seeing all the content that the selected user has flagged.

After much research and advice, I was able to eventually accomplish this! The solution was that I had to set up 2 views:

one being a content view.
and the other one being a user view.

Some more details about these views:

Each of these views with properly configured relationships and contextual filters).
Only after using 'Rewrite Results' field on the user view (shown below). - Redirecting the output field as a link to the path created by the content view displaying the correctly associated users flagged content.

Here is a screenprint of the 'Rewrite Results' in my User view:

MISSION ACCOMPLISHED, so I thought ...

However, this is all fine and dandy with 1 problem: when landing into the URL which contains a nice display of the content flagged by the user that was just clicked, I have no way (or 'know' of no way) to successfully migrate the user name into the header of this new page! Labeling & confirming the content now in front of them. So after clicking on a user name with flagged count of content, you land on a nice page of content, but it's unlabeled!

I need to somehow pass, to the new page, the UID (not logged-in!) of the user that was just selected by clicking on the user's name. I cannot figure out how to do.

I tried using the Token Filter module to place the variable into a custom block heading the new page, but it did not work (Token Type not supported).

Any help, hints or suggestions would be highly appreciated!


texts: Trying to access PHP library from within another namespace

texts:
I'm a little new to the concept of Namespaces in PHP/Drupal, and I'm trying to figure out where I am going wrong here.

I've got this custom PHP library under the /libraries folder - let's call it ilib. And inside of ilib, there is another directory called lms.

Anyway, I've written a little module that will connect with ilib (or I am attempting to get it to connect with it), called ilib_connect.

I am trying to do a test function inside a custom page with a controller for the page, as such:

namespace Drupal\ilib_connect\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Link;
use Drupal\Core\Url;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use ilib\lms;

/**
 * Controller routines for page example routes.
 */
class iLibController extends ControllerBase {

function ilib_connect_test() {
  $lms = new \ilib\lms;
  \Drupal::logger("ilib_connect")->notice("<pre>" . $lms . "</pre>");
  $lms->AddLMSActivity();
  return "fake markup";
  }

}

However I am getting the error:

Error: Class 'ilib\lms' not found in Drupal\ilib_connect\Controller\iLibController->ilib_connect_test() (line 17 of modules/custom/ilib_connect/src/Controller/iLibController.php).

So I'm sorta having trouble pulling any classes from ilib into scope.

How exactly do I pull a third party library into scope in a situation like this? What about in a .module file?

What exactly am I misunderstanding here?

EDIT: Oh and just to be clear, this is how I am registering the custom library with Composer:

"autoload": {
"psr-4": {"ilib\\": "web/libraries/ilib"}
}

EDIT 2 - question to Clive:

Ah, so say I've got a file named AddLMSActivity.php inside of libraries/ilib/lms, setup like this:

namespace ilib\lms;

class AddLMSActivity
{

}

How would I access it exactly?

ilib\lms\AddLMSActivity?


texts: How to display form module in two coloms?

texts:
I again looking for your help.
I have a form module that should be displayed in two coloms, like this one:
http://www.quickbase.com/help/images/form_example.gif
I did a lot of researches for how to solve this and couldn't find so much.

do I need both functions hook_form_alter and hook_theme?

should they look like this?
function my_module_form_alter(&$form, &$form_data, $form_id){ if(stripos($form, 'my_module_form') === 0 && $form['#parameters'][2]->type =='product') {
        $form_data['#theme']  = 'mytemplate';
         }
}

function my_module_theme()
    {
          return array(
            'my_module_form' => array(
              'arguments' => array('form' => NULL),
              'template' => 'mytemplate',
            ),
          );
        }

What should contain file mytemplate.tpl.php ?

Here is part of my form:
function my_module_form($form_data) {
    $form['contact_information'] = array(
        '#value' => variable_get('contact_form_information', t('Please fill in all fields.'))
    );
    $form['first'] = array(
        '#type' => 'textfield',
        '#title' => t('First name'),
        '#maxlength' => 20,
        '#required' => TRUE,
    );
    $form['last'] = array(
        '#type' => 'textfield',
        '#title' => t('Last name'),
        '#maxlength' => 20,
        '#required' => TRUE,
    );
    $form['street'] = array(
        '#type' => 'textfield',
        '#title' => t('Street Address'),
        '#required' => TRUE,
    );
ect

Finally I solved it:
function my_module_theme($existing, $type, $theme, $path) {
  $hooks['my_module_form'] = array(
    'template' => 'mytemplate',
    'arguments' => array('form' => NULL),
  );
  return $hooks;
}

and here is mytemplate.tpl.php

        <?php print_r(drupal_render($form['contact_information'])); ?>

        <?php print_r(drupal_render($form['first'])); ?>

        <?php print_r(drupal_render($form['last'])); ?>

        <?php print_r(drupal_render($form['street'])); ?>

        <?php print_r(drupal_render($form['city'])); ?>

        <?php print_r(drupal_render($form['postal'])); ?>

        <?php print_r(drupal_render($form['state'])); ?>

        <?php print_r(drupal_render($form['mobile'])); ?>

        <?php print_r(drupal_render($form['ext'])); ?>

        <?php print_r(drupal_render($form['phone'])); ?>

        <?php print_r(drupal_render($form['home_phone'])); ?>

        <?php print_r(drupal_render($form['email'])); ?>

                <?php echo drupal_render($form['submit']),
                            drupal_render($form['clear']); ?>


texts: Translation "Global: Text area" in views footer

texts:
I use Internationalization module for multilingual site.
Is there a way to translate custom text in views footer except of creating a new view for a second laguage?


texts: Views of products just showing the first time a taxonomy term is used?

texts:
OK, so I have my product in Drupal Commerce basically sorted by two major taxonomies - Sport and Product Category.

What I want to do is set up a view that prints out the available product categories for a particular sport (i.e. if a product has a particular sport associated with it, then sort through that list and find what product categories are available for that sport).

I have the view somewhat figured out - but it keeps giving me repeats of the product category, where I only want a particular product category name to show up once.

For instance,  if I search for the sport 'Football'  - I get a list that looks like this:
  - Balls & Tees
  - Shirts
  - Balls & Tees
  - Balls & Tees
  - Pads
  - Shirts
  - Shoes
etc. . .

What I want is for those duplicates to be removed (so Balls & Tees only show up once).

In my current view, I have it set up to return fields of content - with the Taxonomy name of  Product Category as my only field.

I have a conditional filter of the parameter set.

I do have a relationship set of Content: Taxonomy terms on node.

I tried using aggregation DISTINCT option, but that doesn't seem to help.

I have looked through this topic -https://drupal.org/node/1200536#comment-4957410 - but I am not sure if its related or not.

Any ideas?


texts: Redirecting and removing user role after user account submit

texts:
I like to redirect my users after they submit their user/edit page.
On their user/edit submit i like to remove a certain role from them as well.
The redirect hasn't been a problem however removing the role is.

In a custom module i have the following code:

  function regform_user_profile_form_submit($form, &$form_state) {
  global $user;
 drupal_goto('user/' . $user->uid);

I am quit a beginner with php and couldn't find any could that fitted in this function properly.
Using rules is not an option as it conflicts with the Oauth module.

Help appreciated,
thanks.


texts: Why is doing KernelTests Code Coverage so slow?

texts:
In my D8 project I have Unit and Kernel tests.
Running them (via CLI) without "--coverage-html" is fine.
Unit tests in general are ~300ms, Kernels are around 3s (of course based on the size of dependencies and the amount of the test cases).

But when I also want to have code coverage Unit tests are fast as usual but Kernel tests are incredible slow (10-20 minutes).

I started to use filters and whitelisting in the phpunit config file, but that affects only the result (the generated coverage files) but not the speed, which makes the impression that PHPUnit also loops through the Kernel Dependencies (such as core files).

Has anyone met this problem before? What can cause it?

Here is my filtering options:

<filter>
    <whitelist>
        <directory suffix=".php">./web/modules/custom/test_module</directory>
    </whitelist>
</filter>


texts: Want a select option of a field saved in another form

texts:
i have a web form having following fields for sales department:
client name(text field), quarter(select option), countries(select option), Annual fees(number), Monthly fees(number), setup(fees)......

now i want to create a form in which i can have a list of all the client saved by above form
 for management to allot resources for the client

please suggest any module required or coding which required.

need help urgently on this


texts: Redirect to a Multi-site Install Failing

texts:
We're trying to redirect a subdomain to a multisite install on an Amazon EC2 Server.  The initial redirect worked like a champ -- it went to the raw IP and we created a directory in sites (sites/54.235.145.17) matching the IP address.

So, now we're trying to do "Masked Subdomain Forwarding" from godaddy.com and it isn't working.  It is always resolving to the raw IP address directory.  We've done:

Created the matching subdirectory:
(demo2.kcl.com)
Created a separate database for the new site
Modified settings.php to access said database

The directory listing:

drwxrwxrwx 6 bitnami daemon  4096 Feb  7 02:20 .
drwxr-x--- 9 bitnami daemon  4096 Jan 27 22:13 ..
drwxrwxrwx 3 bitnami daemon  4096 Jan 29 12:39 54.235.145.17
drwxrwxrwx 5 bitnami daemon  4096 Feb  2 07:53 all
drwxrwxrwx 3 bitnami daemon  4096 Jan 29 12:36 default
-rwxrwxrwx 1 bitnami daemon  2365 Jan 16 21:45 example.sites.php
drwxr-xr-x 3 bitnami daemon  4096 Feb  7 04:06 demo2.kcl.com
-rwxrwxrwx 1 bitnami daemon   904 Jan 16 21:45 README.txt

If I'm reading the documentation correctly, this should work but it is not.  As I said, it simply resolves back to the raw IP address.

Any solutions or even just things to check would be greatly appreciated.

Thanks in advance!

Scott.

(NOTE: IP and domain names have been changed to protect the ... spammable.)


texts: how to link a select field options with the database records

texts:
i am doing some experiments within my custom form and that is to display a table record from database only corresponding to the product code (i.e sku) is selected from the select list. The database has following structure:

nid | sku | orderin | orderout | created

I want to link the sku in select list and the sku in database table so that when i select a sku then data corresponding to that sku should only display. Below is what I have done so far.

Query for the select list

function formModule_display($form, &$form_state)
{

  // The form we are building
  $form = array();

 $result = db_query("SELECT o.nid, o.sku FROM {formmodule_order} o ");

    $options = array();
   foreach($result as $row) {
      $options[$row->nid] = $row->sku;

    }

Query for record display

 $query = db_select('formmodule_order', 'h')
   ->fields('h',array('nid','sku','orderIn','orderOut','created'))
   ->orderBy('h.nid', 'ASC')
   ->condition('$options[$row->nid]', array('pen-11'));

    $result = $query->execute();


texts: Adding a non-link element to the end of the breadcrumb

texts:
For example, in a "blog post" page I'd like the breadcrumb to display like this:

  Blog > Recipes > Recipe

I'm controlling all breadcrumbs from a single place, a class that implements BreadcrumbBuilderInterface. Its build method looks like this:

public function build(RouteMatchInterface $route_match) {
  $b = new Breadcrumb();

  $node = $route_match->getParameter('node');

  if ($node && $node->getType() == 'blog_post') {
    $b->addLink(Link::createFromRoute($this->t('Blog'), 'blog.home'));
    $b->addLink(Link::createFromRoute($this->t('Recipes'), 'blog.recipes_landing'));

    //I want this next item to not be a link, and to show "Recipe" and not the node title.
    //$b->addLink(Link::createFromRoute($this->t('Recipe'), 'nothing!'));
  }

  return $b;
}

How can I make this happen? I saw somewhere (not sure where, in a code comment perhaps) that this last item is supposed to be added in the theme layer, but I don't want to split my logic, especially since I don't just want all breadcrumbs to show the page title as the last item (instead, for example, I want it to say "Recipe" if the content type is blog_post).


texts: How do I conditionally override views cache using preview?

texts:
I'm attempting to embed a view but need to disable the cache in this instance while leaving it enabled in other instances. I'm attmepting to do this using code but nothing I've tried seems to work. Here is my code so far:

  // Get the view and attach the handlers with the build call
  $view_object = views_get_view($view_name);
  $view_object->set_arguments($view_args);
  $view_object->build($view_display);

  // Manually editing the cache here does nothing
  //$view_object->display_handler->options['cache']['type'] = 'none';

  // Override option breaks the view object and the get plugin does nothing.
  $view_object->display_handler->override_option('cache', 'none');

  // Prints tell me that the previous two lines have not actualy changed the cache method.
  dsm($view_object->display_handler, 'display handler');
  dsm($view_object->display_handler->get_plugin('cache'), 'get plugin cache');

  // Returns the cached copy of the view despite changing the option.
  $view_object->execute($view_display);

Any views experts out there know how to override this cache option?


texts: How do I implement hook_views_pre_render()?

texts: I need to alter the result of a view. I read I can use hook_views_pre_render(), but in a custom module. I don't have any custom module implemented and I would like to know where and how should I put the code in my project.


texts: Is there a way to override a static twig template?

texts:
So I have 2 themes. The main custom theme we are using and bootstrap as a secondary theme that supports it.
However, there are some things that appear on the page that are only there because of bootstraps twig templates. Is there a way I can override these with my custom templates without editing bootstraps twig templates?
Here is a example:
{% if title %}
  <h1{{ title_attributes.addClass('page-header') }}>{{ title }}</h1>
{% endif %}

This is bootstraps page title and I would like to remove it without editing bootstraps twig templates. Is there a way I can overwride this with my templates? I already made a custom page twig template, but it adds bootstraps as well.


texts: How to add a field to the contact form in Drupal 7?

texts: I want to add a phone field and a company field to the contact form. How to overwrite the form in template.php? Thank you


texts: I have created block using image block module. I want to translate block content in other languages. I have used i18n module for translation. currently I only translate the title of the block. But I also want translate body content. So,please anyone help me. Thanks in advance


texts: How to add functions inside block PHP code

texts:
I have a node block which contains PHP code snippet. I found that if I define a function in that block and call it within the block, the code seems to break. I know that I can add the function into a module file or something - but just out of curiosity, is it not possible to define and use functions in a PHP snippet code block? My code is just:

<?php

function hello()
{
  echo "hello";
}
hello();
?>

When I run this, all I get is a WSOD. But if I directly echo "hello"; it prints without any problems...


texts: Referencing a referenced entity's fields on a form

texts:
I'm setting up a contact form and would like to implement the following functionality:

On my form I currently have an entity reference field that references the content type 'Home Team' using a select list.
I would like to add another field to my form that populates with a select list of field data based on the content that is selected in the above entity reference field.

To help explain, each 'Home Team' has a field called 'home games' that is a list of text in the format 'Team Name - Date'.

I'd like it to be so that when a user chooses a team from the first select list, the second select list is then populated with that team's home games.

I think that the answer might be by using the Field Reference module, however I'm not sure how to implement what I am needing to do.


texts: How do I display the attachment's file size of a node?

texts: Is there any way in Drupal 7 to display the attachment's file size of a node through the manage file / display of the file field, or is this programmatically achieved?


texts: How to assign 2 taxonomy vocabularies in a single field for a node?

texts:
I have a node. I want to manage fields of this node in the Admin, so I can have a field which is of type Term reference and which uses two or more taxonomy vocabularies. So I can make combinations of 2 vocabularies in the field.

Let's say I have vocabularies A and B. I want to have the field "Categories", which gives the option of choosing from vocabularies A and B. Now, in the normal behaviour of Drupal, I must select one and only one vocabulary when creating the field.


texts: Display content reference with another content

texts:
I just starting using Drupal and I have few question.

Currently I have two Content Types: Project and Task.

Project's field is:

Project title
Body
Date

Task's field is:

Task title
Body
Project (field_project), Entity reference

And I create a view to display List of project.

The problem is, How to display List of task when a project detail is viewed


texts:
I'm looking for alternative modules to create splash pages, similar to this: https://drupal.org/project/splashify

This is the only one I've found but I'm sure there should be more of this.

To make the search I used the "splash" keyword.

Does anyone know any other?

The idea is to popup a "colorbox" frame when the user log in, then the user would be able to check "I don't want to see this information anymore?


texts: Modifying contribution modules safely and conventionally

texts:
I want to modify a contrib module in such a way that I don't lose my customizations whenever I update the module. Below is my git diff from the changes I want to make. I use git and drush.

What I am wondering is, how can I add something to my own custom help module that will have the same affect?

The change I had made was to disable the function in this Facebook connect module that grabs the user's picture and adds it to the profile.

+// Disable facebook profile picture integration (CH)
     // If user pictures are enabled, try to get the profile picture from FB.
-    if (variable_get('user_pictures', 0)) {
-      $fid = simple_fb_connect_get_fb_profile_pic($fb_session);
-      if ($fid) {
-        $fields['picture'] = $fid;
-      }
-    }
+//    if (variable_get('user_pictures', 0)) {
+//      $fid = simple_fb_connect_get_fb_profile_pic($fb_session);
+//      if ($fid) {
+//        $fields['picture'] = $fid;
+//      }
+//    }


texts:
I'm more or lees newbie developing with drupal and now, specifically, I'm trying to create one new entity. I've seen the entity_example given in examples for developers and also I have read this post recomended in the Entity API docs.

I have understood the basics things. I have created the table for the entity, I have defined de entity with the hook_entity_info(), the links for manage page and create one item of this new entity, etc. And it seems to be fine because when I add one item, i can see it on the database.

The problem is when I try to load the entity data. First of all, I have register the url in the hook_menu().

$items['issue/%gissues_issue'] = array(
'title callback' => 'gissues_issue_title',
'title arguments' => array(1),
'page callback' => 'gissues_issue_view',
'page arguments' => array(1),
'access arguments' => array('View Issues'),
'type' => MENU_CALLBACK,
);

Also, I have created the permissions in hook_permission() and two functions, as I have read in docs, for loading one item or multiple items. I show the code of that functions:

function gissues_issue_load($issue_id = NULL, $reset = FALSE) {
    $issue_ids = (isset($issue_id) ? array($issue_id) : array());
    $issue = gissues_issue_load_multiple($issue_ids, $reset);
    return $issue ? reset($issue) : FALSE;
}

function gissues_issue_load_multiple($issue_ids = array(), $conditions = array(), $reset = FALSE) {
    return entity_load('issue', $issue_ids, $conditions, $reset);
}

When I execute the code, I receive this error message:

  Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 173 of /home/user/public_html/formacion/includes/entity.inc).
  Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2168 of /home/user/public_html/formacion/includes/database/database.inc).

I think the entity_load function is not receiving the correct data. The function needs an array with the IDs and it's receiving an array of array. This is what the dpm shows:

  (Array, 1 element)
  0 (Array, 1 element)
    2 (Object) stdClass
      issue_id (String, 1 characters ) 2
      bundle_type (String, 13 characters ) general_issue
      [

    entity data

      ]
      rdf_mapping (Array, 0 elements)

So that, I'm quite lost. May be its something simple or maybe not, but I can't figure out what I'm doing wrong o what i'm forgetting to do.

Any help would be appreciated.


texts: How to have a webpage File Save As filename different from the page URL?

texts:
For example - see this BBC News Page: http://www.bbc.co.uk/news/entertainment-arts-16578905

Now Save the page as a web page - notice how the actual filename of the file saved ( BBC News - Golden Globes  Ricky Gervais 'subdued', say critics.htm ) is different from the last URL fragment ( "entertainment-arts-16578905" ).

Drupal has great clean meaningful URL rewriting, I would like to use this as much as possible, so, for me, another example might be e.g. http://example.com/blog/entry-2012-01-17 and the filename could be "mysite.com - blog entry on 2012-01-17.html"

I'm sure that there might be a meta or otherwise setting in the HTML to achieve this, but how can Drupal insert this?


texts:
I am trying to build a service that will leverage the Pathauto service so my class looks like this.
namespace Drupal\some_system;

use Drupal\pathauto\PathautoGenerator;
use Drupal\pathauto\AliasCleaner;
use Symfony\Component\DependencyInjection\ContainerInterface;

class ProcessUrl
{
  /**
   * @var PathautoGenerator
   */

  protected $pathautoGenerator;

  /**
   * @var AliasCleaner
   */
  protected $aliasCleaner;

  /**
   * ProcessUrl constructor.
   * @param PathautoGenerator $pathautoGenerator
   * @param AliasCleaner $aliasCleaner
   */

  public function __construct(PathautoGenerator $pathautoGenerator, AliasCleaner $aliasCleaner)
  {
    $this->pathautoGenerator = $pathautoGenerator;
    $this->aliasCleaner = $aliasCleaner;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('pathauto.generator'),
      $container->get('pathauto.alias_cleaner')
    );
  }

  public function testurl(){
    dump("Need to reach Here");
    exit();
  }

}

and my services.yml file looks like this.
services:
 some_group_system.process_url:
    class: Drupal\some_system\ProcessUrl
    argumrnts: ['@pathauto.generator','@pathauto.alias_cleaner']

Now when I call this service  \Drupal::service('some_group_system.process_url')->testurl(); it throws an error to me saying
Too few arguments to function Drupal\some_system\ProcessUrl::__construct(), 0 passed in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 265 and exactly 2 expected

I cleared cache and reran but not sure why it is saying this. Please help on this.


texts: Problems setting up CKEditor to embed a video (Brightcove) from the media module in Drupal 7?

texts:
I'm using the Media Module to hook Brightcove videos into Drupal. I have to embed these videos into CKEditor via the media module's browser. When I do this, I can select the video from the media browser, but it gets embedded as a placeholder image, and is never rendered into a video after saving. I have read that a placeholder image (or fake object) is used by CKEditor while editing, so I'm not worried there. I simply need the video to render once I get to the front end.

When selecting an image from the media browser, an additional dialog will pop-up with how the image should be rendered (preview-type, width/height, etc). When selecting a video, I do not get a customized menu, but something that seems to be default, with no options, and no indication that CKEditor has detected a video.

I've tried this in the CKEditor Modules, as well as WYSIWYG Modules, with the CKEditor Plugin. I'm using CKEditor 4.4. Neither version has worked. Brightcove/Media Module mention that moving forward, they'll support the WYSIWYG Module with CKEditor, but neither that, nor the CKEditor Module successfully render a video, unless I use the Media Embed Plugin, and find the embed code myself.

So, am I missing steps to render a video added to CKEditor via the Media Module, or is something broken with the latest releases of these modules' integrations into Drupal 7.


texts: Vagrant Drupal Development (VDD) Up Stalls

texts:
I'm trying to figure out why vagrant is stalling. I installed VirtualBox 4.3.12 and Vagrant 1.6.2, and then grabbed Vagrant Drupal Development (VDD) environment. When trying to bring the machine up it will immediately stall, stuck on: default: Verifying Hyper-V is enabled...

==> Default: Verifying Hyper-V is enabled...
INFO subprocess: Starting process: ["c:\\Windows\\System32\\WindowsPowerShell\\
v1.0\\/powershell.EXE", "-NoProfile", "-ExecutionPolicy", "Bypass", "&('c:\\Hash
iCorp\\Vagrant\\embedded\\gems\\gems\\vagrant-1.6.2\\plugins\\providers\\hyperv\
\scripts\\check_hyperv.ps1')", "-ErrorAction", "Stop"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stderr: The term 'ConvertTo-Json' is not recognized as the nam
e of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.2\plugins\providers\hype
rv\scripts\check_hyperv.ps1:10 char:38
+ Write-Output-Message $(ConvertTo-Json <<<<  $result)
    + CategoryInfo          : ObjectNotFound: (ConvertTo-Json:String) [], Comm
   andNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

DEBUG subprocess: stdout: ===Begin-Output===

===End-Output===


texts: add role to existing user on hook_entity_presave

texts:
I'm trying to add a role to a user but I can't save the change.
function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity){
  $user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
  $user->addRole('foobar');
}

I would like to save the change, but $user->save() causes a fatal error.
What would be the correct way?
Note: The error is a whitescreen of death. I guess $user->save() is for creating new users. I would need to update an existing one.